diff --git a/src/mail-app/mail/view/CollapsedMailView.ts b/src/mail-app/mail/view/CollapsedMailView.ts index 3ea49b425877..70e334c5440c 100644 --- a/src/mail-app/mail/view/CollapsedMailView.ts +++ b/src/mail-app/mail/view/CollapsedMailView.ts @@ -27,6 +27,8 @@ export class CollapsedMailView implements Component { ".flex.items-center.pt.pb.click.no-wrap", { class: responsiveCardHPadding(), + role: "button", + "aria-expanded": "false", style: { color: theme.content_button, }, diff --git a/src/mail-app/mail/view/MailViewerHeader.ts b/src/mail-app/mail/view/MailViewerHeader.ts index 32524505404f..3b50515adfdd 100644 --- a/src/mail-app/mail/view/MailViewerHeader.ts +++ b/src/mail-app/mail/view/MailViewerHeader.ts @@ -193,63 +193,59 @@ export class MailViewerHeader implements Component { 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 {