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 cannot focus mail more button on mobile screen readers #8196

Merged
merged 1 commit into from
Dec 30, 2024
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
2 changes: 2 additions & 0 deletions src/mail-app/mail/view/CollapsedMailView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export class CollapsedMailView implements Component<CollapsedMailViewAttrs> {
".flex.items-center.pt.pb.click.no-wrap",
{
class: responsiveCardHPadding(),
role: "button",
"aria-expanded": "false",
style: {
color: theme.content_button,
},
Expand Down
104 changes: 50 additions & 54 deletions src/mail-app/mail/view/MailViewerHeader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,63 +193,59 @@ export class MailViewerHeader implements Component<MailViewerHeaderAttrs> {
const { viewModel } = attrs
const classes = this.makeSubjectActionsLineClasses()

return m(
classes,
{
role: "button",
"mail-expander": "true",
"aria-expanded": !viewModel.isCollapsed(),
tabindex: TabIndex.Default,
onclick: (e: MouseEvent) => {
viewModel.collapseMail()
e.stopPropagation()
},
onkeydown: (e: KeyboardEvent) => {
if (isKeyPressed(e.key, Keys.SPACE, Keys.RETURN) && (e.target as HTMLElement).hasAttribute("mail-expander")) {
return m(classes, [
m(
".flex.flex-grow.align-self-start.items-start",
{
class: styles.isSingleColumnLayout() ? "mt-m" : "mt",
role: "button",
"mail-expander": "true",
// "aria-expanded" is always true because this component is only used in expanded view
"aria-expanded": "true",
tabindex: TabIndex.Default,
onclick: (e: MouseEvent) => {
viewModel.collapseMail()
e.preventDefault()
}
},
},
[
m(
".flex.flex-grow.align-self-start.items-start",
{
class: styles.isSingleColumnLayout() ? "mt-m" : "mt",
e.stopPropagation()
},
[
viewModel.isUnread() ? this.renderUnreadDot() : null,
viewModel.isDraftMail()
? m(
".mr-xs.align-self-center",
m(Icon, {
icon: Icons.Edit,
container: "div",
style: {
fill: theme.content_button,
},
hoverText: lang.get("draft_label"),
}),
)
: null,
this.tutaoBadge(viewModel),
m("span.text-break" + (viewModel.isUnread() ? ".font-weight-600" : ""), viewModel.getDisplayedSender()?.name ?? ""),
],
),
m(
".flex-end.items-start.ml-between-s",
{
class: styles.isSingleColumnLayout() ? "" : "mt-xs",
style: {
// align "more" button with the datetime text
marginRight: styles.isSingleColumnLayout() ? "-3px" : "6px",
},
onclick: (e: MouseEvent) => e.stopPropagation(),
onkeydown: (e: KeyboardEvent) => {
if (isKeyPressed(e.key, Keys.SPACE, Keys.RETURN) && (e.target as HTMLElement).hasAttribute("mail-expander")) {
viewModel.collapseMail()
e.preventDefault()
}
},
this.moreButton(attrs),
),
],
)
},
[
viewModel.isUnread() ? this.renderUnreadDot() : null,
viewModel.isDraftMail()
? m(
".mr-xs.align-self-center",
m(Icon, {
icon: Icons.Edit,
container: "div",
style: {
fill: theme.content_button,
},
hoverText: lang.get("draft_label"),
}),
)
: null,
this.tutaoBadge(viewModel),
m("span.text-break" + (viewModel.isUnread() ? ".font-weight-600" : ""), viewModel.getDisplayedSender()?.name ?? ""),
],
),
m(
".flex-end.items-start.ml-between-s",
{
class: styles.isSingleColumnLayout() ? "" : "mt-xs",
style: {
// align "more" button with the datetime text
marginRight: styles.isSingleColumnLayout() ? "-3px" : "6px",
},
onclick: (e: MouseEvent) => e.stopPropagation(),
},
this.moreButton(attrs),
),
])
}

private renderUnreadDot(): Children {
Expand Down
Loading