Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions mobile/lib/features/channels/channels_page/body.dart
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,11 @@ class _SliverChannelsList extends HookConsumerWidget {
}

// Only the team sections record can be edited, and only until desktop's
// unified workspaces exist.
// unified workspaces exist. Sorted as displayed, so Move up and Move down
// follow what the user sees, not storage order.
final teamSections = sectionsState.editable
? sectionsState.store.sections
? (sectionsState.store.sections.toList()
..sort((a, b) => a.order.compareTo(b.order)))
: const <ChannelSection>[];
final teamSectionIds = {for (final s in teamSections) s.id};
Widget row(Channel channel, String key) => isSoloRow(channel)
Expand Down
20 changes: 14 additions & 6 deletions mobile/lib/features/channels/channels_page/sections.dart
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,22 @@ class _CustomSectionHeader extends StatelessWidget {
child: Row(
children: [
Expanded(
child: _SectionLabel(
// The options button stays its own screen-reader stop.
child: Semantics(
label: label,
icon: switch (section.icon) {
final icon? => _WorkspaceIcon(icon),
null => null,
},
button: true,
expanded: expanded,
color: sectionColor,
onTap: onToggle,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The outer GestureDetector still supplies its own accessibility tap. Flutter keeps the two tap configurations separate, so screen readers can focus an unlabeled row-wide toggle in addition to the named expand/collapse button. Set excludeFromSemantics: true on the outer detector to preserve pointer taps and leave the named button as the sole accessibility toggle. Extend the journey to check for one toggle and activate it through its semantic tap.

excludeSemantics: true,
child: _SectionLabel(
label: label,
icon: switch (section.icon) {
final icon? => _WorkspaceIcon(icon),
null => null,
},
expanded: expanded,
color: sectionColor,
),
),
),
if (_usesNativeSectionMenu(context))
Expand Down
36 changes: 33 additions & 3 deletions mobile/test/features/channels/sidebar_workspaces_journey_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ void main() {
relay.stored.add(
relay.event('channel-sections', {
'version': 1,
// Stored out of display order, as a Move up leaves them.
'sections': [
{'id': 'old', 'name': 'Old', 'order': 0},
{'id': 'old', 'name': 'Old', 'order': 1},
{'id': 'newer', 'name': 'Newer', 'order': 0},
],
'assignments': {'design-crit': 'old'},
}, now - 60),
Expand All @@ -66,7 +68,13 @@ void main() {
),
channelsProvider.overrideWith(_Channels.new),
meGroupsProvider.overrideWith(
(ref) => Stream.value(const MeGroups()),
(ref) => Stream.value(
const MeGroups(
groups: [
{'id': 'focus', 'name': 'Focus', 'defaultTemplateId': ''},
],
),
),
),
defaultAgentProvider.overrideWith((ref) => Stream.value(null)),
meAssistantsProvider.overrideWith((ref) async => []),
Expand Down Expand Up @@ -97,14 +105,35 @@ void main() {
);
double top(String text) => tester.getTopLeft(inList(text)).dy;

// Legacy sections stay editable.
// Legacy sections stay editable, and their moves follow display order.
expect(top('design-crit'), greaterThan(top('Old')));
expect(top('Old'), greaterThan(top('Newer')));
await tester.tap(find.byTooltip('Old options'));
await tester.pumpAndSettle();
expect(find.text('Rename section'), findsOneWidget);
ListTile option(String label) => tester.widget<ListTile>(
find.ancestor(of: find.text(label), matching: find.byType(ListTile)),
);
expect(option('Move up').enabled, isTrue);
expect(option('Move down').enabled, isFalse);
await tester.tap(find.text('Cancel'));
await tester.pumpAndSettle();

// A Solo project header tells a screen reader whether it is expanded.
final semantics = tester.ensureSemantics();
final focus = find.bySemanticsLabel('Focus');
expect(
tester.getSemantics(focus),
isSemantics(isButton: true, hasExpandedState: true, isExpanded: true),
);
await tester.tap(inList('Focus'));
await tester.pumpAndSettle();
expect(
tester.getSemantics(focus),
isSemantics(isButton: true, hasExpandedState: true, isExpanded: false),
);
semantics.dispose();

// Desktop saves its unified records; they arrive live.
for (final head in [
relay.event('channel-workspaces', {
Expand All @@ -130,6 +159,7 @@ void main() {
}
await tester.pumpAndSettle();
expect(inList('Old'), findsNothing);
expect(inList('Focus'), findsNothing);

final order = [
'Starred',
Expand Down
Loading