Skip to content

Commit

Permalink
added more accessibility labels to icons and actions
Browse files Browse the repository at this point in the history
  • Loading branch information
hjiangsu committed Jun 23, 2023
1 parent f3dbea4 commit 1c6056f
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 14 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
### Added
- External links can now be opened in an external browser, and also shared using the system's sharing options
- Improved GIF support - contribution from @MrAntonS
- Improved accessibility labels for icons and actions
- New compact view for posts in the feed
- New OLED black theme

### Fixed
- Potentially fixed issue where scrolling behaviour is weird when creating a new post or comment
Expand Down
5 changes: 4 additions & 1 deletion lib/account/pages/account_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ class _AccountPageState extends State<AccountPage> {
if (authState.isLoggedIn)
IconButton(
onPressed: () => showProfileModalSheet(context),
icon: const Icon(Icons.people_alt_rounded),
icon: const Icon(
Icons.people_alt_rounded,
semanticLabel: 'Profiles',
),
)
],
),
Expand Down
5 changes: 4 additions & 1 deletion lib/community/pages/community_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,10 @@ class _CommunityPageState extends State<CommunityPage> with AutomaticKeepAliveCl
),
);
},
child: const Icon(Icons.add),
child: const Icon(
Icons.add,
semanticLabel: 'Create Post',
),
)
: null,
body: SafeArea(child: _getBody(context, state)),
Expand Down
5 changes: 4 additions & 1 deletion lib/community/pages/create_post_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ class _CreatePostPageState extends State<CreatePostPage> {
context.read<CommunityBloc>().add(CreatePostEvent(name: _titleTextController.text, body: _bodyTextController.text));
Navigator.of(context).pop();
},
icon: const Icon(Icons.send_rounded),
icon: const Icon(
Icons.send_rounded,
semanticLabel: 'Create Post',
),
),
],
),
Expand Down
5 changes: 4 additions & 1 deletion lib/post/pages/post_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ class PostPage extends StatelessWidget {
},
);
},
child: const Icon(Icons.reply_rounded),
child: const Icon(
Icons.reply_rounded,
semanticLabel: 'Reply to Post',
),
)
: null,
body: SafeArea(
Expand Down
5 changes: 4 additions & 1 deletion lib/post/widgets/create_comment_modal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ class _CreateCommentModalState extends State<CreateCommentModal> {
context.read<PostBloc>().add(CreateCommentEvent(content: _bodyTextController.text, parentCommentId: widget.commentView?.comment.id));
Navigator.of(context).pop();
},
icon: const Icon(Icons.send_rounded),
icon: const Icon(
Icons.send_rounded,
semanticLabel: 'Reply',
),
),
],
),
Expand Down
5 changes: 4 additions & 1 deletion lib/search/pages/search_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ class _SearchPageState extends State<SearchPage> {
resetTextField();
context.read<SearchBloc>().add(ResetSearch());
},
icon: const Icon(Icons.close),
icon: const Icon(
Icons.close,
semanticLabel: 'Clear Search',
),
)
],
hintText: 'Search for communities',
Expand Down
5 changes: 4 additions & 1 deletion lib/shared/image_viewer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ class ImageViewer extends StatelessWidget {
IconButton(
color: theme.textTheme.titleLarge?.color,
onPressed: () => Navigator.pop(context),
icon: const Icon(Icons.close),
icon: const Icon(
Icons.close,
semanticLabel: 'Close Preview',
),
),
],
),
Expand Down
11 changes: 7 additions & 4 deletions lib/shared/media_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ class MediaView extends StatelessWidget {
child: const SizedBox(
height: 75.0,
width: 75.0,
child: Icon(Icons.article_rounded),
child: Icon(
Icons.article_rounded,
semanticLabel: 'Article Link',
),
),
),
);
Expand Down Expand Up @@ -84,10 +87,10 @@ class MediaView extends StatelessWidget {
Container(
alignment: Alignment.center,
padding: const EdgeInsets.all(20),
child: const Column(
child: Column(
children: [
Icon(Icons.warning_rounded, size: 55),
Text("NSFW - Tap to unhide", textScaleFactor: 1.5),
const Icon(Icons.warning_rounded, size: 55),
if (viewMode != ViewMode.compact) const Text("NSFW - Tap to unhide", textScaleFactor: 1.5),
],
),
),
Expand Down
15 changes: 12 additions & 3 deletions lib/shared/webview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,24 @@ class NavigationControls extends StatelessWidget {
return Row(
children: <Widget>[
IconButton(
icon: const Icon(Icons.replay_rounded),
icon: const Icon(
Icons.replay_rounded,
semanticLabel: 'Refresh',
),
onPressed: () async => await webViewController.reload(),
),
IconButton(
icon: const Icon(Icons.open_in_browser_rounded),
icon: const Icon(
Icons.open_in_browser_rounded,
semanticLabel: 'Open in Browser',
),
onPressed: () => launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication),
),
IconButton(
icon: const Icon(Icons.share_rounded),
icon: const Icon(
Icons.share_rounded,
semanticLabel: 'Share',
),
onPressed: () => Share.share(url),
),
const SizedBox(width: 8.0),
Expand Down

0 comments on commit 1c6056f

Please sign in to comment.