Skip to content
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

[Fix] no-unknown-property: support onBeforeToggle, popoverTarget, popoverTargetAction attributes #3865

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

acusti
Copy link
Contributor

@acusti acusti commented Dec 10, 2024

Fixes #3864

Copy link

codecov bot commented Dec 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.80%. Comparing base (01ac0a2) to head (73a1461).
Report is 31 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3865      +/-   ##
==========================================
+ Coverage   97.70%   97.80%   +0.09%     
==========================================
  Files         136      136              
  Lines        9950     9978      +28     
  Branches     3685     3703      +18     
==========================================
+ Hits         9722     9759      +37     
+ Misses        228      219       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines -185 to +192
<button popovertarget="my-popover" popovertargetaction="toggle">Open Popover</button>
<button popoverTarget="my-popover" popoverTargetAction="toggle">Open Popover</button>

<div popover id="my-popover">Greetings, one and all!</div>
<div id="my-popover" onBeforeToggle={this.onBeforeToggle} popover>Greetings, one and all!</div>
</div>
`,
settings: {
react: { version: '19.0.0' },
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems like this test passed previously - instead of changing the existing one, can we add a new test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ljharb yeah that’s fair. just to confirm, however, do you want the plugin to allow both the all-lowercase version and the camelCased version of those attributes? before React added proper support in facebook/react#27981, the only way to use the attributes without getting console warning from react was to use the all-lowercase version of the attribute names. but it seems like now that the support has shipped in latest stable, it would be better to ensure that people always use the officially supported versions of the attributes, which is why i removed the all-lowercase versions of them (meaning that my changes make the original version of the test no longer pass).

i’m happy to do whichever seems best to you. there’s probably a semver consideration here also. i could even pretty easily redo the implementation so that for react >= 19, we replace the popovertarget and popovertargetaction attributes with the camel-cased version and then i can have test cases for both.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it already supported the all-lowercase one, then yes, it'd be semver-major to stop supporting it.

@ljharb ljharb marked this pull request as draft December 23, 2024 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Unknown property 'onBeforeToggle' found (react/no-unknown-property)
2 participants