Skip to content

Conversation

@yjbanov
Copy link
Contributor

@yjbanov yjbanov commented Jul 8, 2024

Multiple fixes related to heading levels:

  • Fix heading level absorption. Heading level would get erased when a semantics config is absorbed into another. With this change the highest heading level wins.
  • Add headingLevel to the diagnostics of SemanticsNode.
  • Add unit-tests for heading levels.
  • Add an a11y use-case for headings.

Improves #46789 and general accessibility of headings.

@yjbanov yjbanov requested a review from chunhtai July 8, 2024 17:01
@github-actions github-actions bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) labels Jul 8, 2024
<title>a11y_assessments</title>
<link rel="manifest" href="manifest.json">

<script>
Copy link
Contributor

Choose a reason for hiding this comment

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

do you know what this does?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This doesn't do anything any more. It's gone. The app was generating warnings because it still used the defunct API.


import 'use_cases.dart';

class HeadingsUseCase extends UseCase {
Copy link
Contributor

Choose a reason for hiding this comment

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

This may not be a good use case for GAR, If we want to show case this we should probably provide a more comprehensive widget that uses heading semantics. for example Appbar or expansionTile

Copy link
Contributor Author

@yjbanov yjbanov Jul 8, 2024

Choose a reason for hiding this comment

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

If you have an article with plain text headings and paragraphs, what would be the idiomatic way to express it in Flutter? For example, let's take this wikipedia page - https://en.wikipedia.org/wiki/Hawaii. It has headings, such as "Etymology" and "Spelling of state name" at different levels. What widgets would you use to build this page in Flutter, and how would you communicate heading levels to the semantics correctly?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that will be our customer's responsibility to verify GAR if they compose our widgets to create a page. Of course we need make sure provide enough API for them to do so, but I think that should be a unit test instead.

The scope of a11y_assessment is to test individual material or cupertino components that we provide, so I don't think this use case fit in the assessment.

// Heading levels are lower-is-higher (1 is the highest; 6 is the lowest),
// except 0, which means "not a heading", i.e. it's the lowest. Hence the
// complicated boolean expression.
final bool isChildHeadingLevelHigher =
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we choose the highest from children? should we instead let the parent override children's heading like what we do for value or hint?

Copy link
Contributor Author

@yjbanov yjbanov Jul 8, 2024

Choose a reason for hiding this comment

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

My personal logic is that if a widget declares that it's H1, then it also probably uses a large text font to communicate it. If you are merging multiple headings then the merged node will be no smaller than the largest node in the merge group. But I'm open to other interpretations of what "merging" means in this case. If there's an established convention, let's go with that.

Copy link
Contributor

@chunhtai chunhtai Jul 9, 2024

Choose a reason for hiding this comment

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

I think as of now all the other attributes are parent overriding the children's. I am more incline to preserve the behavior.

Also there is another mergeAllDescendantsIntoThisNode in getSemanticData, and it looks like the logic is wrong there as well.

@yjbanov yjbanov requested a review from chunhtai July 9, 2024 20:24
Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

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

LGTM

@yjbanov yjbanov force-pushed the heading-level-fixes branch from 720d523 to 756303c Compare July 10, 2024 03:59
@yjbanov yjbanov added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 10, 2024
@auto-submit
Copy link
Contributor

auto-submit bot commented Jul 10, 2024

auto label is removed for flutter/flutter/151421, due to - The status or check suite Mac_arm64 build_tests_1_4 has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 10, 2024
@yjbanov yjbanov added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 10, 2024
@auto-submit auto-submit bot merged commit fe07fb4 into flutter:master Jul 10, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 10, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 10, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 10, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 10, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 10, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 11, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 11, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 11, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 11, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 12, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 12, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 12, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 12, 2024
ditman added a commit to ditman/flutter-packages that referenced this pull request Jul 12, 2024
Roll Flutter from 5103d75 to 58068d8 (42 revisions)

flutter/flutter@5103d75...58068d8

2024-07-12 [email protected] Reland: Move all Linux Moto G4 tests to mokey in staging (flutter/flutter#151654)
2024-07-12 [email protected] Update obsolete comment in InputDecorator test (flutter/flutter#151651)
2024-07-12 [email protected] Fix `TabBar` tab indicator stretch effect (flutter/flutter#150868)
2024-07-12 [email protected] Remove workaround for a bug in dart2wasm (flutter/flutter#151603)
2024-07-12 [email protected] [native_assets] Stop running link hooks in JIT mode (flutter/flutter#151534)
2024-07-12 [email protected] Roll `Switch.adaptive` changes into `CupertinoSwitch` (flutter/flutter#149465)
2024-07-11 [email protected] Unmark java11 tests as bringup:true (flutter/flutter#151612)
2024-07-11 [email protected] Add link to design document archive (flutter/flutter#151489)
2024-07-11 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Move all Linux Moto G4 tests to mokey in staging (#151608)" (flutter/flutter#151620)
2024-07-11 [email protected] Move all Linux Moto G4 tests to mokey in staging (flutter/flutter#151608)
2024-07-11 [email protected] docimports for API samples (flutter/flutter#151606)
2024-07-11 [email protected] docimports for flutter_goldens, flutter_localizations, flutter_web_plugins, fuchsia_remote_debug_protocol, integration_test (flutter/flutter#151271)
2024-07-11 [email protected] Re-enable debug canvaskit e2e tests. (flutter/flutter#151565)
2024-07-11 [email protected] Fix: Submenu anchor misaligned with child panel in web (Resolved #151081) (flutter/flutter#151294)
2024-07-11 [email protected] Replaced {@tool snippet} with {@tool dartpad} in CupertinoTabController (flutter/flutter#151272)
2024-07-11 [email protected] feat: Support overriding native endorsed plugins (flutter/flutter#137040)
2024-07-11 [email protected] expose keyboardType in DropdownMenu #150894 (flutter/flutter#150896)
2024-07-11 [email protected] docimports for flutter_driver (flutter/flutter#151267)
2024-07-11 [email protected] Add `TimeOfDay` comparison methods (flutter/flutter#151233)
2024-07-11 [email protected] Roll Flutter Engine from 6534fbf3c2c1 to 36dccf7bb25c (2 revisions) (flutter/flutter#151577)
2024-07-11 [email protected] Roll Flutter Engine from 1c23c8f64076 to 6534fbf3c2c1 (3 revisions) (flutter/flutter#151572)
2024-07-11 [email protected] Use correct locale for `CupertinoDatePicker` weekday (flutter/flutter#151494)
2024-07-10 [email protected] doc imports for enum values (flutter/flutter#151548)
2024-07-10 [email protected] Reland "Upgrade template Gradle, App AGP, Module AGP, and Kotlin versions, and tests"... but no longer upgrade module AGP version (flutter/flutter#151433)
2024-07-10 [email protected] Roll Packages from 14341d1 to ea35fc6 (16 revisions) (flutter/flutter#151556)
2024-07-10 [email protected] [CupertinoActionSheet] Fix padding and font size of buttons (flutter/flutter#151199)
2024-07-10 [email protected] Roll Flutter Engine from db2b45bea2c0 to 1c23c8f64076 (2 revisions) (flutter/flutter#151550)
2024-07-10 [email protected] Add docImports for flutter_test references (flutter/flutter#151175)
2024-07-10 [email protected] Mention not @-mentioning people in commit messages in tree hygiene (flutter/flutter#151487)
2024-07-10 [email protected] Roll Flutter Engine from 371db85f33d7 to db2b45bea2c0 (8 revisions) (flutter/flutter#151522)
2024-07-10 [email protected] fix heading level absorption, diagnostics; add tests and an a11y use-case (flutter/flutter#151421)
2024-07-10 [email protected] Roll Flutter Engine from 9d943eb2b37a to 371db85f33d7 (3 revisions) (flutter/flutter#151505)
2024-07-10 [email protected] Roll Flutter Engine from d3269d5855a7 to 9d943eb2b37a (5 revisions) (flutter/flutter#151495)
2024-07-09 [email protected] Update doc of `SemanticsProperties.identifier` (flutter/flutter#149915)
2024-07-09 [email protected] Clean up leaky test. (flutter/flutter#151131)
2024-07-09 [email protected] Roll pub packages (flutter/flutter#151492)
2024-07-09 [email protected] testAdd tests for stepper.controls_builder.0.dart (flutter/flutter#150669)
2024-07-09 [email protected] Add Semantics Property `linkUrl` (flutter/flutter#150639)
2024-07-09 [email protected] Roll Flutter Engine from 4a2ac0e51a8f to d3269d5855a7 (1 revision) (flutter/flutter#151488)
2024-07-09 [email protected] Link engine docs on AS setup in flutter/flutter docs on engine contributor setup (flutter/flutter#151481)
2024-07-09 [email protected] Roll Flutter Engine from 69075e7e87d4 to 4a2ac0e51a8f (21 revisions) (flutter/flutter#151482)
2024-07-09 [email protected] Fix Material 3 `Dialog` default background color (flutter/flutter#151400)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
...
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: accessibility Accessibility, e.g. VoiceOver or TalkBack. (aka a11y) a: text input Entering text in a text field or keyboard related problems autosubmit Merge PR when tree becomes green via auto submit App framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants