-
Notifications
You must be signed in to change notification settings - Fork 198
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
docs: fix and document use of keyboard focus classes on text fields #3354
Conversation
|
🚀 Deployed on https://pr-3354--spectrum-css.netlify.app |
File metricsSummaryTotal size: 4.26 MB* 🎉 No changes detected in any packages * Size determined by adding together the size of the main file for all packages in the library.* Results are not gzipped or minified. * An ASCII character in UTF-8 is 8 bits or 1 byte. |
0599bcf
to
34aac90
Compare
@jawinn Overall, the PR looks great! Out of curiosity, why isn't there a keydown function in the template to showcase If it's up to SWC to handle this kind of functionality then showing the Docs example and clearly stating what class has to be added would be enough. |
34aac90
to
7a068d6
Compare
It's getting a little bit into implementation as it's a bit tricky to test for (keycode is not provided on the focus event), but I found what looks like an okay way to show this behavior. I've updated the PR and validation instructions. |
` | ||
}, context); | ||
|
||
export const KeyboardFocusTemplate = (args, context) => Container({ |
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.
Nice!
Our Storybook was adding the keyboard focus class on click, which isn't the intended design. Click focus and focused by use of a keyboard have different styles. This update stops the class from being applied on click, and documents how the class should be added by the implementation.
Example functionality in our Storybook to add the keyboard focused class to the text field when it was focused with the tab key, similar to what is documented for implementations.
Remove some examples of keyboard focus from docs stories, that are not necessary to show now that keyboard focus has its own docs example.
7a068d6
to
f759731
Compare
Description
Our Storybook was adding the
is-keyboardFocused
class on click, which isn't the intended design. Click focus and focused by use of a keyboard have different styles. This update stops the class from being applied on click, applies it on tab focus, and documents how the class should be added by the implementation.How and where has this been tested?
Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.
Validation steps
is-keyboardFocused
class is documented correctly on both the text field and text area DocsRegression testing
Validate:
Screenshots
New Docs story:
Design reference for styling differences between focus and focused by keyboard:
To-do list