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

fix: Card does not override specified focusMode based on event listeners #32200

Merged
merged 3 commits into from
Aug 6, 2024

Conversation

smhigley
Copy link
Contributor

@smhigley smhigley commented Aug 1, 2024

Previous Behavior

It was impossible to have both a focusMode=off or focusMode=tab-only card with a click handler on the root. There are several reasons to do this (e.g. the card as a whole can be clicked as a larger hit target, and there's also a link or button within that does the same thing). The change in focusMode actually interferes with accessibility, because it makes it impossible to have a card with both a root click and enter/space handler, since a card with any focusMode apart from off will prevent enter from doing an author-defined action.

Authors already must provide a secondary method for performing any action put onto the card root, since any such actions will not be accessible to voice control, touch screen readers, etc.

New Behavior

This updates the default focusMode to be tab-only when cards are interactive, but still allows users to override that with there own explicit focusMode. I chose tab-only instead of no-tab as the least heavy-handed tabster behavior, and the least different from the non-interactive default of off.

We could also consider having the default always be off, and not looking at whether or not there are event handlers attached to the root. I wasn't sure if there was another non-a11y reason to ensure cards are focusable when they have certain event handlers.

Related Issue(s)

@fabricteam
Copy link
Collaborator

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-card
Card - All
101.225 kB
28.664 kB
101.234 kB
28.665 kB
9 B
1 B
react-card
Card
94.009 kB
26.813 kB
94.018 kB
26.813 kB
9 B
react-components
react-components: entire library
1.095 MB
270.363 kB
1.095 MB
270.362 kB
9 B
-1 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-card
CardFooter
14.356 kB
5.798 kB
react-card
CardHeader
16.879 kB
6.664 kB
react-card
CardPreview
14.42 kB
5.934 kB
react-components
react-components: Button, FluentProvider & webLightTheme
69.141 kB
20.157 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
217.326 kB
63.005 kB
react-components
react-components: FluentProvider & webLightTheme
44.442 kB
14.607 kB
react-portal-compat
PortalCompatProvider
8.39 kB
2.64 kB
react-timepicker-compat
TimePicker
106.751 kB
35.596 kB
🤖 This report was generated against aa652de894084d5e10cbc708aa4542cc46916856

@fabricteam
Copy link
Collaborator

Perf Analysis (@fluentui/react-components)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 648 637 5000
Button mount 297 314 5000
Field mount 1147 1127 5000
FluentProvider mount 723 704 5000
FluentProviderWithTheme mount 83 88 10
FluentProviderWithTheme virtual-rerender 36 38 10
FluentProviderWithTheme virtual-rerender-with-unmount 86 78 10
MakeStyles mount 878 857 50000
Persona mount 1767 1765 5000
SpinButton mount 1379 1410 5000
SwatchPicker mount 1680 1672 5000

@smhigley smhigley merged commit edd3637 into microsoft:master Aug 6, 2024
19 checks passed
marcosmoura added a commit to marcosmoura/fluentui that referenced this pull request Aug 7, 2024
* master: (48 commits)
  chore: migrate to storybook v7 (microsoft#32018)
  release: applying package updates - react-components
  ci: make public-docsite-v9 deploy pipeline work and make it faster (microsoft#32248)
  fix(Toolbar): hardcode size of `ToolbarButton` (microsoft#32185)
  chore: deprecate @fluentui/react-motion-preview (microsoft#32190)
  release: applying package updates - web-components
  docs: add wrapping menu item example to ContextualMenu docs (microsoft#31289)
  docs: update title of v8 keyboard-accessible drag & drop example, add docs (microsoft#32216)
  release: applying package updates - react-components
  fix: Card does not override specified focusMode based on event listeners (microsoft#32200)
  Fix undefined reference in older browsers in useMessageBarReflow (microsoft#32238)
  feat: Add transparent appearance to ToolbarButton (microsoft#32205)
  fix(react-tabs): ignore ref for tab reserved space content slot (microsoft#31775)
  fix(Dialog): do not require ref forwarding (microsoft#32095)
  feat: add verify-packaging to react v8 release pipeline (microsoft#32212)
  chore(web-components): remove type-check definition and follow repo target defaults for consistency and type-check speeds (microsoft#32208)
  chore(react-tree): improve ImmutableSet and ImmutableMap internal implementation (microsoft#32167)
  release: applying package updates - web-components
  feat(web-components): add tablist (microsoft#32098)
  release: applying package updates - react-components
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants