[DOM] Add support for the `inert` attribute
See original GitHub issueDo you want to request a feature or report a bug?
Feature
What is the current behavior?
When specifying inert={false}
on an element, React throws the following message:
Warning: Received `false` for a non-boolean attribute `inert`.
However, inert={undefined}
works fine as a replacement for false
, while inert=""
(empty string) provides an escape hatch as a truthy value.
What is the expected behavior?
The inert
attribute should be accepted as a boolean DOM attribute, as proposed by the HTML Standard.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:6 (1 by maintainers)
Top Results From Across the Web
HTMLElement.inert - Web APIs | MDN
The HTMLElement property inert reflects the value of the element's inert attribute. It is a boolean value that, when present, makes the browser...
Read more >inert | Polyfill for the inert attribute and property. - GitHub Pages
The inert attribute/property allows web authors to mark parts of the DOM tree as inert: ... Either import the polyfill, or add the...
Read more >Non-interactive Elements with the inert attribute
What is the inert attribute? · It is not focusable. · It behaves similarly to aria-hidden="true" for assistive technologies ...
Read more >"inert" attribute - HTML
The inert attribute would allow web authors to mark parts of the DOM tree as inert: When a node is inert, then the...
Read more >Using HTML inert property to manage user focus
Using inert in incompatible browsers ... It is good practice to think of the instances where new features might not be supported and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The
inert
attribute will be supported by all major engines very soon and this issue should be reopened.@kripod it looks like the spec doesn’t explicitly define an
inert
attribute yetWe should probably wait until the spec defines this as a boolean attribute before adding it to the list. In the meantime the workaround you mentioned with
inert=""
should be sufficient!