-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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(#2336): Fields without description are losing focus when an error is shown for the first time. #2422
Conversation
β¦ is shown for the first time. π Bug Report If you have a TextField without a description, the focus on the field is lost as soon as an error is shown for the first time. This probably happens for all the fields that have Helper Text option. π€ Expected Behavior Field should keep focus. π― Current Behavior Field is losing the focus when the error is shown. π Possible Solution Probably use a useLayoutEffect to restore focus to the input if the input had focus previously. π¦ Context π» Code Sample https://codesandbox.io/s/lost-focus-44wtq π Your Environment Software Version(s) react-spectrum 3.14.0 Browser Chrome Operating System macOS 11.6
Build successful! π |
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.
Chromatic identified one issue https://www.chromatic.com/build?appId=5f0dd5ad2b5fc10022a2e320&number=141
I'm not sure if we'll be able to do anything about it, though it's weird that it's only affecting the large scale
I think this has to do with: react-spectrum/packages/@adobe/spectrum-css-temp/components/fieldlabel/index.css Lines 95 to 98 in b4a3821
.spectrum-Field.spectrum-Field--positionSide .spectrum-Field-wrapper , but if I remove it or change it based on hasHelpText , I get more chromatic errors in other components. like ColorField.
Can we accept the ComboBox changes as a new baseline? Also, I notice that the NumberField layout is broken by the use of react-spectrum/packages/@adobe/spectrum-css-temp/components/fieldlabel/index.css Line 145 in b4a3821
|
@majornista yeah, Forms are pretty broken already #2324 |
Build successful! π |
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, tested locally by porting over the example from the codesandbox into our storybook. Is there an existing story that covers this bug (couldn't find one myself)? If so, I can approve otherwise would be good to add a test story to the HelpText stories
Build successful! π |
π Bug Report
If you have a TextField without a description, the focus on the field is lost as soon as an error is shown for the first time. This probably happens for all the fields that have Helper Text option.
π€ Expected Behavior
Field should keep focus.
π― Current Behavior
Field is losing the focus when the error is shown.
π Possible Solution
Probably use a useLayoutEffect to restore focus to the input if the input had focus previously.
π¦ Context
π» Code Sample
https://codesandbox.io/s/lost-focus-44wtq
π Your Environment
Software Version(s)
react-spectrum 3.14.0
Browser Chrome
Operating System macOS 11.6
Closes #2336
β Pull Request Checklist:
π Test Instructions:
π§’ Your Project:
Adobe/Accessibility