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

Various a11y fixes for SearchBar and BadgeView #2054

Merged
merged 4 commits into from
Jul 9, 2024

Conversation

lukas-cap
Copy link
Contributor

@lukas-cap lukas-cap commented Jul 2, 2024

Platforms Impacted

  • iOS
  • visionOS
  • macOS

Description of changes

Problems

Our SearchBar and BadgeView have a few a11y and layout issues.

  • the clear text button is not accessible (no large content viewer)
  • fonts are adjusting for dynamic type only on initial load. This is because our tokens auto-scale, but only when you fetch the token. The control needs to track subsequent content size category updates.
  • the space we give the leadingView is only calculated once, and doesn't react to parent view size changes or content size category updates (where the leading view may need more space).
  • SearchBar has fixed height, and the largest content size categories were causing the fonts to get clipped
  • BadgeView doesn't fill its largeContentTitle prop, so when largeContentViewer is enabled it shows a blank view.

For this PR, I'm assuming our SearchBar fixed height is a hard limit - changing this could have major fallout for clients. Instead let's make this view as accessible as we can within the limits.

  • Introduce a max size category - still fairly large, but not large enough to break the view.
  • Cover the edge cases with large content viewer support on all the subviews.
  • Rewrite our layout code for leadingView - this now uses pure Auto Layout to enforce min width for the input field, but also good amount of space for leadingView
  • Ensure fonts adjust to all subsequent dynamic type updates
  • Reuse existing localized string for the clear button a11y label and large content title

Binary change

Total increase: 6,464 bytes
Total decrease: -1,776 bytes

File Before After Delta
Total 30,961,480 bytes 30,966,168 bytes ⚠️ 4,688 bytes
Full breakdown
File Before After Delta
SearchBar.o 371,312 bytes 376,888 bytes ⚠️ 5,576 bytes
BadgeView.o 628,352 bytes 629,240 bytes ⚠️ 888 bytes
FocusRingView.o 835,736 bytes 835,656 bytes 🎉 -80 bytes
SearchBarTokenSet.o 82,256 bytes 81,528 bytes 🎉 -728 bytes
__.SYMDEF 4,754,288 bytes 4,753,320 bytes 🎉 -968 bytes

Verification

Local testing in sim, various dynamic type size, restricted width scenarios, screen rotation, usage inside Fluent NavigationController.

Visual Verification
Before After
Default dynamic type Screenshot 2024-07-03 at 4 18 54 PM Screenshot 2024-07-03 at 4 16 54 PM
Max dynamic type before reload Screenshot 2024-07-03 at 11 26 18 AM Screenshot 2024-07-03 at 11 30 03 AM
Max dynamic type after reload Screenshot 2024-07-03 at 11 26 35 AM Screenshot 2024-07-03 at 11 30 41 AM

Pull request checklist

This PR has considered:

  • Light and Dark appearances
  • iOS supported versions (all major versions greater than or equal current target deployment version)
  • VoiceOver and Keyboard Accessibility
  • Internationalization and Right to Left layouts
  • Different resolutions (1x, 2x, 3x)
  • Size classes and window sizes (iPhone vs iPad, notched devices, multitasking, different window sizes, etc)
  • iPad Pointer interaction
  • SwiftUI consumption (validation or new demo scenarios needed)
  • Objective-C exposure (provide it only if needed)
Microsoft Reviewers: Open in CodeFlow

@lukas-cap lukas-cap marked this pull request as ready for review July 3, 2024 18:45
@lukas-cap lukas-cap requested a review from a team as a code owner July 3, 2024 18:45
@lukas-cap lukas-cap enabled auto-merge (squash) July 9, 2024 18:03
@lukas-cap lukas-cap merged commit f4d271b into microsoft:main Jul 9, 2024
7 checks passed
KeithA45 pushed a commit to KeithA45/fluentui-apple that referenced this pull request Jul 16, 2024
mischreiber pushed a commit that referenced this pull request Jul 17, 2024
Co-authored-by: Lukas Capkovic <3610850+lcapkovic@users.noreply.github.com>
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.

2 participants