8000 Attribute inert is not working on Safari · Issue #5014 · lit/lit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Attribute inert is not working on Safari #5014
Closed
@YannDuv

Description

@YannDuv

Which package(s) are affected?

Lit Core (lit / lit-html / lit-element / reactive-element)

Description

When using the inert attributes on the host like so:

<my-custom-el inert></my-custom-el>

I am expecting all click events to be prevented. But it looks like it is not the case only with Safari

Reproduction

@customElement("my-custom-el")
export class InertIssue extends LitElement {
  connectedCallback(): void {
    super.connectedCallback();
    this.addEventListener("click", () => alert("KO"));
  }

  render() {
    return html`CLICK ME`;
  }
}

Workaround

  • Using an inert on a parent element works:
<div inert>
  <my-custom-el></my-custom-el>
</div>
  • Or using a condition on this.hasAttribute('inert') in the event callback

Is this a regression?

No or unsure. This never worked, or I haven't tried before.

Affected versions

Failing in 2.7.6, 2.8.0

Browser/OS/Node environment

Browser: Safari Version 18.4 (20621.1.15.11.10)
MacOs: 15.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0