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

docs: fix and document use of keyboard focus classes on text fields #3354

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jawinn
Copy link
Collaborator

@jawinn jawinn commented Oct 30, 2024

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, 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

  • Clicking in a text field or text area does not add the keyboard focused class (blue focus indicator does not appear)
  • How implementations should apply the is-keyboardFocused class is documented correctly on both the text field and text area Docs

Regression testing

Validate:

  1. The documentation pages for at least two other components are still loading, including:
  • The pages render correctly, are accessible, and are responsive.
  1. If components have been modified, VRTs have been run on this branch:
  • VRTs have been run and looked at.
  • Any VRT changes have been accepted (by reviewer and/or PR author), or there are no changes.

Screenshots

New Docs story:
Screenshot 2024-10-30 at 1 54 13 PM

Design reference for styling differences between focus and focused by keyboard:
text-field-spec-1

To-do list

  • I have read the contribution guidelines.
  • I have updated relevant storybook stories and templates.
  • If my change impacts documentation, I have updated the documentation accordingly.
  • ✨ This pull request is ready to merge. ✨

Copy link

changeset-bot bot commented Oct 30, 2024

⚠️ No Changeset found

Latest commit: 34aac90

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@jawinn jawinn added documentation Because documentation is important and shouldn't be broken ready-for-review labels Oct 30, 2024
Copy link
Contributor

github-actions bot commented Oct 30, 2024

🚀 Deployed on https://pr-3354--spectrum-css.netlify.app

Copy link
Contributor

github-actions bot commented Oct 30, 2024

File metrics

Summary

Total size: 4.30 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.

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.
@jawinn jawinn force-pushed the jawinn/css-1041-text-field-keyboard-focus branch from 0599bcf to 34aac90 Compare October 30, 2024 21:35
@aramos-adobe
Copy link
Collaborator

@jawinn Overall, the PR looks great!

Out of curiosity, why isn't there a keydown function in the template to showcase isKeyboardFocused indicator when tab is pressed. In the documentation you mentioned if the tab key is pressed this class should be added. When I press tab is-focused gets added.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Because documentation is important and shouldn't be broken ready-for-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants