-
Notifications
You must be signed in to change notification settings - Fork 47.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DOM] Add support for the inert
attribute
#17157
Comments
Also, type declarations are required for TypeScript development, so |
@kripod it looks like the spec doesn't explicitly define an
We 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 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you! |
The |
Seems like |
Trying to use When your framework is perpetually struggling to be compatible with the web that's kind of sign, right? Can we get #24730 merged please! |
@jfbrennan behind every framework we use, there are human beings with feelings. No one forces you to use React as-is: you could either fix in on your own through a fork or use another library. Please be respectful to the maintainers and evaluate your own contributions before blaming anyone. I’ve got tired of open source due to the attitude shown above. As a community, I think we should call this behavior out and remind consumers to be grateful towards contributors. |
@kripod oh I understand and I'm with you about respecting and collaborating with open-source folks. But let's not get it twisted, React is totally different. |
Workaround (thank you @kripod!): DefinitelyTyped/DefinitelyTyped#39289 (comment)
Edit: if you run into:
... fixes include:
I'm not 100% sure which option is best, I'm going with "1" for now. Your mileage may vary, I'm using |
Yeah, I used to be compelled to workaround IE too. I already stuck this hack into our app and moved on (not the first time). This is absolutely a step backwards for the frontend community and we all know it. This kind of thing should have died with IE never to be tolerated again. It's been 3.5 years since this issue was opened - ample time to get React prepared for the day when browsers support this attribute (not to the mention error of a design that requires a framework to be maintained alongside the HTML spec). React is a corporate project with a multi-million dollar budget and highly paid full-time maintainers. Again, really great people just like the old IE team, but it is unacceptable to drag your feet for over 3 years on web standards like this and other instances. Not to mention the persistent failure to support Web Components. The PR is there - has been for a year - and here we are adding 13 lines of TS to make HTML's |
Namely the fork https://github.com/eps1lon/react/tree/feat/inert Hopefully, the react project will find this suitable for merging in #24730 |
Workaround (JS): <div inert="" /> Workaround (TS): <div {...{inert:""}} /> |
I'm currently using it like this:
Would be nice if it could be supported by default, though. |
4 years issue for the native html attribute, cmon |
In 2019, @aweary wrote:
Which I think was quite sensible. I don't know when exactly this changed, but as of now it looks like the HTML spec officially defines it as a boolean. |
When I, as of 2024 January 18, go to canisue, it seems that all browsers support the Caniuse also links to the specification for inert. It seems like its time to add support for |
@johann1301s, it's gotten better over the years, but React's design effectively makes it a browser and needs its own column on caniuse. I originally opened this request as a troll, but your comment and all the frequent disappointment here makes me think we might need to take this more seriously Fyrd/caniuse#6699 A framework should not be a web standards gatekeeper - that was IE's job! |
|
Hi @eps1lon, we just got an update for the As you mentioned this was only meant for experimental and stable in React 19 so the patch version bump is incorrect or at least doesn't work as expected 🤔 . This would rather be a breaking change that should only be included in We have pinned the |
@Cuuki Something in your app is pulling in types for the The stable types do not have types for |
I confirm I have the same issue as @Cuuki and I am definitely not importing EDIT: Though maybe Next.js, which I use, is doing it? |
I think I did that in Next.js for convenience a while ago not realizing they vendor Canary not Experimental. I'll check how we can fix it. Might need to break users of experimental features. I recommend upgrading and annotating breakages with |
We are authoring a component library with multiple packages in a monorepo, other than I had already checked for experimental occurence usage earlier but it could of course be that some of the dependencies pull in the experimental types but I can't be sure. If I find some time in the upcoming days I can try to analyze this further, in the meantime I will go with the |
Same happening here (I'm also using NextJs, so there's definitely a pattern here). We have very strict rules agains using |
Should this issue be reopened until React 19? 🤷 i.e. this comment |
We shipped the cc @xec |
Other maintainers check for existence of |
Would |
For now but no guarantees that it won't break later. 3rd party tooling may complain about non-standard values. |
Do 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:However,
inert={undefined}
works fine as a replacement forfalse
, whileinert=""
(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.The text was updated successfully, but these errors were encountered: