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 big date separators when jump to date is enabled #10404

Merged
merged 4 commits into from
Mar 20, 2023
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
8 changes: 6 additions & 2 deletions res/css/views/messages/_DateSeparator.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ limitations under the License.
border-bottom: 1px solid $menu-selected-color;
}

.mx_DateSeparator > h2 {
margin: 0 25px;
.mx_DateSeparator_dateContent {
padding: 0 25px;
}

.mx_DateSeparator_dateHeading {
flex: 0 0 auto;
margin: 0;
font-size: inherit;
font-weight: inherit;
color: inherit;
Expand Down
14 changes: 11 additions & 3 deletions src/components/views/messages/DateSeparator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,14 @@ export default class DateSeparator extends React.Component<IProps, IState> {

return (
<ContextMenuTooltipButton
className="mx_DateSeparator_jumpToDateMenu"
className="mx_DateSeparator_jumpToDateMenu mx_DateSeparator_dateContent"
onClick={this.onContextMenuOpenClick}
isExpanded={!!this.state.contextMenuPosition}
title={_t("Jump to date")}
>
<h2 aria-hidden="true">{this.getLabel()}</h2>
<h2 className="mx_DateSeparator_dateHeading" aria-hidden="true">
{this.getLabel()}
</h2>
<div className="mx_DateSeparator_chevron" />
{contextMenu}
</ContextMenuTooltipButton>
Expand All @@ -225,7 +227,13 @@ export default class DateSeparator extends React.Component<IProps, IState> {
if (this.state.jumpToDateEnabled) {
dateHeaderContent = this.renderJumpToDateMenu();
} else {
dateHeaderContent = <h2 aria-hidden="true">{label}</h2>;
dateHeaderContent = (
<div className="mx_DateSeparator_dateContent">
<h2 className="mx_DateSeparator_dateHeading" aria-hidden="true">
{label}
</h2>
</div>
);
}

// ARIA treats <hr/>s as separators, here we abuse them slightly so manually treat this entire thing as one
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,16 @@ exports[`<MessageEditHistory /> should match the snapshot 1`] = `
<hr
role="none"
/>
<h2
aria-hidden="true"
<div
class="mx_DateSeparator_dateContent"
>
Thu, Jan 1 1970
</h2>
<h2
aria-hidden="true"
class="mx_DateSeparator_dateHeading"
>
Thu, Jan 1 1970
</h2>
</div>
<hr
role="none"
/>
Expand Down Expand Up @@ -165,11 +170,16 @@ exports[`<MessageEditHistory /> should support events with 1`] = `
<hr
role="none"
/>
<h2
aria-hidden="true"
<div
class="mx_DateSeparator_dateContent"
>
, NaN NaN
</h2>
<h2
aria-hidden="true"
class="mx_DateSeparator_dateHeading"
>
, NaN NaN
</h2>
</div>
<hr
role="none"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,16 @@ exports[`DateSeparator renders the date separator correctly 1`] = `
<hr
role="none"
/>
<h2
aria-hidden="true"
<div
class="mx_DateSeparator_dateContent"
>
Today
</h2>
<h2
aria-hidden="true"
class="mx_DateSeparator_dateHeading"
>
Today
</h2>
</div>
<hr
role="none"
/>
Expand All @@ -38,12 +43,13 @@ exports[`DateSeparator when feature_jump_to_date is enabled renders the date sep
aria-expanded="false"
aria-haspopup="true"
aria-label="Jump to date"
class="mx_AccessibleButton mx_DateSeparator_jumpToDateMenu"
class="mx_AccessibleButton mx_DateSeparator_jumpToDateMenu mx_DateSeparator_dateContent"
role="button"
tabindex="0"
>
<h2
aria-hidden="true"
class="mx_DateSeparator_dateHeading"
>
Fri, Dec 17 2021
</h2>
Expand Down

Large diffs are not rendered by default.