-
Notifications
You must be signed in to change notification settings - Fork 599
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
ActionBar: Add disabled
support to ActionBar
#5666
Conversation
🦋 Changeset detectedLatest commit: b626615 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks! |
size-limit report 📦
|
@andrejusk, quick implementation question! Are you expecting the IconButton not to be actionable when disabled, or are you handling this in your implementation? Right now we're using |
👋 @TylerJDev our current implementation always sets the |
f7125a9
to
9cf870a
Compare
const clickHandler = useCallback( | ||
(event: React.MouseEvent<HTMLButtonElement>) => { | ||
if (disabled) { | ||
return | ||
} | ||
onClick?.(event) | ||
}, | ||
[disabled, onClick], | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this to block the onClick
that a consumer might attach to the button. The button could still be activated on an onKeyDown
event, but I don't think that's as likely to be added here.
Curious on any thoughts on this method, and if it just be adjusted or not 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we still add a keydown eventhandler then? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After doing a bit more testing, I realize we probably don't need to add one for keydown. onClick
will handle most cases that we'd expect when utilizing a keyboard. We also probably don't want consumers using onKeyDown
instead of onClick
. I adjusted the tests to reflect this!
const clickHandler = useCallback( | ||
(event: React.MouseEvent<HTMLButtonElement>) => { | ||
if (disabled) { | ||
return | ||
} | ||
onClick?.(event) | ||
}, | ||
[disabled, onClick], | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we still add a keydown eventhandler then? 🤔
Doesn't hurt! I can go ahead and add it just in case |
https://github.com/github/primer/issues/4613
Changelog
Changed
disabled
support onActionBar.IconButton
disabled
stateRollout strategy
Testing & Reviewing
Merge checklist