-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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 button focus #7287
Fix button focus #7287
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
LGTM
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.
I don't understand why this component isn't a native <button>
(there may well be a good reason). I think this change is an improvement because now it is focusable, but the default behaviour of href="#"
is to jump the page to the top so that's not ideal either
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.
I don't think this is an appropriate fix, we should be using tabindex and other properties.
There are numerous reasons, mostly because all our "buttons" are links, this one is deceptively the only one that is not a button. Per specification a |
yeah guys this is not the proper way, sorry for late replying, you are right |
hey guys @mikeesto @AugustinMauroy @ovflowd @bjohansebas could you please review my code, if there is any suggestion PLZ 😊 |
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.
Button focus seems good to me 👍
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.
Everything seems to be working fine, LGTM
@faridomarAf please resolve the CI failures if you have time |
Apologies for not checking in here, have been busy with personal matters 🙏 |
hi @bmuenzenmeyer , sorry for late response, I think the changes which I made in Button.tsx file, it caused the error, so a I checked the original code that is working, I would do my best to solve the issue |
Signed-off-by: Claudio W <[email protected]>
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.
LGTM!
Thanks for the first time contribution! Excited to get this merged ✨ |
hey guys thank you so much for your follow up, actually it was my fist time to contribute in an open source project. all your comments an code views values much more for me |
Button focusable issue fixed
Description
While we are using a Link-component for both Button & Link purposes, there should be a logic when it use as a Link it should acts as a Link, and when it use as Button it should as Button.
1: Enhancements to Button Component::
role
tobutton
only when used as a button.onClick
andtabIndex
behave appropriately based on component usage.2: Enhancements to CodeBox Component:
useState
hook to manage the disabled state of theCopy
button.useEffect
to dynamically update the button'sdisabled
state based on the presence of content in the<pre>
element.tabIndex
on the<pre>
element for improved accessibility.Copy
button if no content is available to copy.Validation
https://www.loom.com/share/6f237ae46e7945f48650c1e710399e6f?sid=f8f6c2fc-faca-46e8-901a-021c38f091f9
Related Issues
#7247
Check List
npm run format
to ensure the code follows the style guide.npm run test
to check if all tests are passing.npx turbo build
to check if the website builds without errors.