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

feat(Form): Disable autofocus on error for some fields on iOS #1307

Merged
merged 4 commits into from
Jan 14, 2025

Conversation

pladaria
Copy link
Member

@pladaria pladaria commented Jan 2, 2025

Fields that are excluded from autofocus on error in iOS because the focus action opens the picker/selector

  • date
  • datetime-local
  • month
  • select

Note: scroll to element not affected

A simple unit test that covers these scenarios has been added but you can be manually test this using playroom with a snippet like:

<Form>
  <Stack space={16}>
    <Select
      name="field"
      label="field"
      options={[{ value: "x", text: "x" }]}
    />
    <ButtonPrimary submit>Submit</ButtonPrimary>
  </Stack>
</Form>

and opening the preview in an iphone

Copy link

github-actions bot commented Jan 2, 2025

Size stats

master this branch diff
Total JS 12.3 MB 12.3 MB +391 B
JS without icons 2.04 MB 2.04 MB +391 B
Lib overhead 72.8 kB 72.8 kB +44 B
Lib overhead (gzip) 17.1 kB 17.1 kB +11 B

Copy link

github-actions bot commented Jan 2, 2025

Accessibility report
✔️ No issues found

ℹ️ You can run this locally by executing yarn audit-accessibility.

Comment on lines +24 to +35
export const isAndroid = (platformOverrides: Theme['platformOverrides']): boolean => {
if (platformOverrides.platform === 'android') {
return true;
}

return getUserAgent(platformOverrides).toLowerCase().includes('android') && !isEdgeOrIE;
};

export const isIos = (platformOverrides: Theme['platformOverrides']): boolean => {
if (platformOverrides.platform === 'ios') {
return true;
}
Copy link
Member Author

@pladaria pladaria Jan 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added to make it easier to force the platform in tests

Copy link

github-actions bot commented Jan 2, 2025

Deploy preview for mistica-web ready!

✅ Preview
https://mistica-m90rbmzlw-flows-projects-65bb050e.vercel.app

Built with commit 0cfd623.
This pull request is being automatically deployed with vercel-action

@pladaria pladaria requested review from atabel and yceballost January 2, 2025 17:05
@pladaria pladaria added this pull request to the merge queue Jan 14, 2025
Merged via the queue into master with commit 316565d Jan 14, 2025
11 checks passed
@pladaria pladaria deleted the pladaria/WEB-2130_form-disable-autofocus branch January 14, 2025 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants