Skip to content
This repository was archived by the owner on Jul 8, 2025. It is now read-only.

Commit 82ec2ce

Browse files
MadLittleModstoomore
authored andcommitted
Fix big date separators when jump to date is enabled (#10404)
Fix element-hq/element-web#22969
1 parent db8d300 commit 82ec2ce

File tree

5 files changed

+47
-19
lines changed

5 files changed

+47
-19
lines changed

res/css/views/messages/_DateSeparator.pcss

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@ limitations under the License.
3030
border-bottom: 1px solid $menu-selected-color;
3131
}
3232

33-
.mx_DateSeparator > h2 {
34-
margin: 0 25px;
33+
.mx_DateSeparator_dateContent {
34+
padding: 0 25px;
35+
}
36+
37+
.mx_DateSeparator_dateHeading {
3538
flex: 0 0 auto;
39+
margin: 0;
3640
font-size: inherit;
3741
font-weight: inherit;
3842
color: inherit;

src/components/views/messages/DateSeparator.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,14 @@ export default class DateSeparator extends React.Component<IProps, IState> {
206206

207207
return (
208208
<ContextMenuTooltipButton
209-
className="mx_DateSeparator_jumpToDateMenu"
209+
className="mx_DateSeparator_jumpToDateMenu mx_DateSeparator_dateContent"
210210
onClick={this.onContextMenuOpenClick}
211211
isExpanded={!!this.state.contextMenuPosition}
212212
title={_t("Jump to date")}
213213
>
214-
<h2 aria-hidden="true">{this.getLabel()}</h2>
214+
<h2 className="mx_DateSeparator_dateHeading" aria-hidden="true">
215+
{this.getLabel()}
216+
</h2>
215217
<div className="mx_DateSeparator_chevron" />
216218
{contextMenu}
217219
</ContextMenuTooltipButton>
@@ -225,7 +227,13 @@ export default class DateSeparator extends React.Component<IProps, IState> {
225227
if (this.state.jumpToDateEnabled) {
226228
dateHeaderContent = this.renderJumpToDateMenu();
227229
} else {
228-
dateHeaderContent = <h2 aria-hidden="true">{label}</h2>;
230+
dateHeaderContent = (
231+
<div className="mx_DateSeparator_dateContent">
232+
<h2 className="mx_DateSeparator_dateHeading" aria-hidden="true">
233+
{label}
234+
</h2>
235+
</div>
236+
);
229237
}
230238

231239
// ARIA treats <hr/>s as separators, here we abuse them slightly so manually treat this entire thing as one

test/components/views/dialogs/__snapshots__/MessageEditHistoryDialog-test.tsx.snap

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,16 @@ exports[`<MessageEditHistory /> should match the snapshot 1`] = `
5353
<hr
5454
role="none"
5555
/>
56-
<h2
57-
aria-hidden="true"
56+
<div
57+
class="mx_DateSeparator_dateContent"
5858
>
59-
Thu, Jan 1 1970
60-
</h2>
59+
<h2
60+
aria-hidden="true"
61+
class="mx_DateSeparator_dateHeading"
62+
>
63+
Thu, Jan 1 1970
64+
</h2>
65+
</div>
6166
<hr
6267
role="none"
6368
/>
@@ -165,11 +170,16 @@ exports[`<MessageEditHistory /> should support events with 1`] = `
165170
<hr
166171
role="none"
167172
/>
168-
<h2
169-
aria-hidden="true"
173+
<div
174+
class="mx_DateSeparator_dateContent"
170175
>
171-
, NaN NaN
172-
</h2>
176+
<h2
177+
aria-hidden="true"
178+
class="mx_DateSeparator_dateHeading"
179+
>
180+
, NaN NaN
181+
</h2>
182+
</div>
173183
<hr
174184
role="none"
175185
/>

test/components/views/messages/__snapshots__/DateSeparator-test.tsx.snap

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,16 @@ exports[`DateSeparator renders the date separator correctly 1`] = `
1111
<hr
1212
role="none"
1313
/>
14-
<h2
15-
aria-hidden="true"
14+
<div
15+
class="mx_DateSeparator_dateContent"
1616
>
17-
Today
18-
</h2>
17+
<h2
18+
aria-hidden="true"
19+
class="mx_DateSeparator_dateHeading"
20+
>
21+
Today
22+
</h2>
23+
</div>
1924
<hr
2025
role="none"
2126
/>
@@ -38,12 +43,13 @@ exports[`DateSeparator when feature_jump_to_date is enabled renders the date sep
3843
aria-expanded="false"
3944
aria-haspopup="true"
4045
aria-label="Jump to date"
41-
class="mx_AccessibleButton mx_DateSeparator_jumpToDateMenu"
46+
class="mx_AccessibleButton mx_DateSeparator_jumpToDateMenu mx_DateSeparator_dateContent"
4247
role="button"
4348
tabindex="0"
4449
>
4550
<h2
4651
aria-hidden="true"
52+
class="mx_DateSeparator_dateHeading"
4753
>
4854
Fri, Dec 17 2021
4955
</h2>

test/utils/exportUtils/__snapshots__/HTMLExport-test.ts.snap

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)