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 some component warnings #558

Merged
merged 2 commits into from Sep 3, 2019

Conversation

@sohkai
Copy link
Member

commented Sep 3, 2019

  • Button: warnOnce() was used incorrectly
  • Popover: try to warn if the opener was a <button> or <input>, and closeOnOpenerFocus is set

The Popover's a bit of a PITA. On macOS, both Firefox and Safari don't focus buttons or inputs on click, hence causing focusevent.relatedTarget to always be null. Users should only be using closeOnOpenerFocus if they expect the opener to be focused, so this adds a warning to let users know they should consider using a different focusable element instead.

Note that this check is not full-proof, since it's a PITA for us to know if the passed in element is actually focusable (we'd need to implement a tag whitelist, check for tabIndex, etc. which probably isn't worth it now).

sohkai added 2 commits Sep 3, 2019

@auto-assign auto-assign bot requested a review from bpierre Sep 3, 2019

@sohkai sohkai referenced this pull request Sep 3, 2019
@@ -149,19 +149,24 @@ function Button({
}) {
// backward compatibility and deprecated props
if (iconOnly) {
warnOnce('Button: "iconOnly" is deprecated, please use "display".')
warnOnce(
'Button:iconOnly',

This comment has been minimized.

Copy link
@bpierre

bpierre Sep 3, 2019

Member

Oops 🙈 It just made me wonder why we have a key at all haha (instead of using the message directly).

This comment has been minimized.

Copy link
@sohkai

sohkai Sep 3, 2019

Author Member

Haha yes, it's not like we ever re-use the keys ;).

@bpierre
bpierre approved these changes Sep 3, 2019
Copy link
Member

left a comment

👍 👍 👍

@sohkai sohkai merged commit d105fcf into newstyle Sep 3, 2019

5 checks passed

License Compliance All checks passed.
Details
WIP Ready for review
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details

@sohkai sohkai deleted the fix-warnings branch Sep 3, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.