Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 4d59a6f

Browse files
luixxiulrichvdh
andauthored
Fix timeline search bar being overlapped by the right panel (#10809)
* Set zero min-width to prevent input area blowout * Set min-width values to mx_SearchBar_input and mx_SearchBar_button * Prevent the input area and cancel button from being overlapped by BaseCard * Use custom properties: --size-button-search * Take Percy snapshot of mx_SearchBar * Apply suggestions from code review Co-authored-by: Richard van der Hoff <[email protected]> * Edit a comment * Feedback * Edit a comment * Update cypress/e2e/timeline/timeline.spec.ts Co-authored-by: Richard van der Hoff <[email protected]> --------- Co-authored-by: Richard van der Hoff <[email protected]>
1 parent d213dff commit 4d59a6f

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

cypress/e2e/timeline/timeline.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,12 @@ describe("Timeline", () => {
714714
cy.visit("/#/room/" + roomId);
715715

716716
cy.get(".mx_RoomHeader").findByRole("button", { name: "Search" }).click();
717+
718+
cy.get(".mx_SearchBar").percySnapshotElement("Search bar on the timeline", {
719+
// Emulate narrow timeline
720+
widths: [320, 640],
721+
});
722+
717723
cy.get(".mx_SearchBar_input input").type("Message{enter}");
718724

719725
cy.get(".mx_EventTile:not(.mx_EventTile_contextual) .mx_EventTile_searchHighlight").should("exist");

res/css/views/rooms/_SearchBar.pcss

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,42 @@ limitations under the License.
1515
*/
1616

1717
.mx_SearchBar {
18-
height: 56px;
18+
/* use `min-height` rather than height, to allow room for the text to wrap if the window is narrow */
19+
min-height: 56px;
1920
display: flex;
2021
align-items: center;
2122
border-bottom: 1px solid $primary-hairline-color;
2223

2324
.mx_SearchBar_input {
25+
--size-button-search: 37px; /* size of the search button inside `input` element */
26+
2427
/* border: 1px solid $input-border-color; */
2528
/* font-size: $font-15px; */
2629
flex: 1 1 0;
2730
margin-left: 22px;
31+
32+
/* do not allow the input element to shrink below the width needed for the placeholder 'Search…'
33+
and the search button */
34+
min-width: calc(7em + var(--size-button-search));
35+
36+
input {
37+
box-sizing: border-box; /* include padding value into width calculation */
38+
}
2839
}
2940

3041
.mx_SearchBar_searchButton {
3142
cursor: pointer;
32-
width: 37px;
33-
height: 37px;
43+
width: var(--size-button-search);
44+
height: var(--size-button-search);
3445
background-color: $accent;
3546
mask: url("$(res)/img/feather-customised/search-input.svg");
3647
mask-repeat: no-repeat;
3748
mask-position: center;
3849
}
3950

4051
.mx_SearchBar_buttons {
41-
display: inherit;
52+
display: inherit; /* flex */
53+
min-width: 0; /* have the close button displayed even on a very narrow timeline */
4254
}
4355

4456
.mx_SearchBar_button {
@@ -50,6 +62,7 @@ limitations under the License.
5062
color: $primary-content;
5163
border-bottom: 2px solid $accent;
5264
font-weight: var(--font-semi-bold);
65+
word-break: break-all; /* prevent the input area and cancel button from being overlapped by BaseCard */
5366
}
5467

5568
.mx_SearchBar_unselected {

0 commit comments

Comments
 (0)