Skip to content

Commit 3848d57

Browse files
authored
Inhibit keyboard highlights in dialogs when effector is not in focus (#31181)
* Inhibit keyboard highlight in spotlight dialog when effector is not in focus Signed-off-by: Michael Telatynski <[email protected]> * Inhibit keyboard highlight in forward dialog when effector is not in focus Signed-off-by: Michael Telatynski <[email protected]> * Fix search box height bouncing on focus/blur Signed-off-by: Michael Telatynski <[email protected]> * Update screenshot Signed-off-by: Michael Telatynski <[email protected]> --------- Signed-off-by: Michael Telatynski <[email protected]>
1 parent eade32a commit 3848d57

File tree

4 files changed

+31
-15
lines changed

4 files changed

+31
-15
lines changed
-366 Bytes
Loading

res/css/structures/_SearchBox.pcss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Please see LICENSE files in the repository root for full details.
99
.mx_SearchBox {
1010
flex: 1 1 0;
1111
min-width: 0;
12+
min-height: 36px; /* to avoid jumping when the X to clear shows/hides */
1213

1314
&.mx_SearchBox_blurred:not(:hover) {
1415
background-color: transparent;

res/css/views/dialogs/_ForwardDialog.pcss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ Please see LICENSE files in the repository root for full details.
6161
/* To match the space around the title */
6262
margin: 0 0 15px 0;
6363
flex-grow: 0;
64+
65+
&:not(:focus-within) + .mx_ForwardList_content {
66+
/* Inhibit the styling if focus is not within the input which handles keyboard accessibility */
67+
--mx_ForwardList_entry_selectedBgColor: transparent;
68+
}
6469
}
6570

6671
.mx_ForwardList_content {
@@ -90,7 +95,7 @@ Please see LICENSE files in the repository root for full details.
9095

9196
&:hover,
9297
&.mx_ForwardList_entry_active {
93-
background-color: $spacePanel-bg-color;
98+
background-color: var(--mx_ForwardList_entry_selectedBgColor, $spacePanel-bg-color);
9499
}
95100

96101
.mx_ForwardList_roomButton {

res/css/views/dialogs/_SpotlightDialog.pcss

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,16 @@ Please see LICENSE files in the repository root for full details.
150150
height: unset;
151151
margin-left: $spacing-16;
152152
}
153+
154+
&:not(:focus-within) + #mx_SpotlightDialog_content {
155+
/* Inhibit the styling if focus is not within the input which handles keyboard accessibility */
156+
--mx_SpotlightDialog_option_selectedBgColor: transparent;
157+
158+
/* Hide the enter prompt as in this state pressing enter would not actuate that option */
159+
.mx_SpotlightDialog_enterPrompt {
160+
visibility: hidden;
161+
}
162+
}
153163
}
154164

155165
#mx_SpotlightDialog_content {
@@ -193,6 +203,17 @@ Please see LICENSE files in the repository root for full details.
193203
}
194204
}
195205

206+
.mx_SpotlightDialog_option {
207+
border-radius: 8px;
208+
overflow: hidden;
209+
text-overflow: ellipsis;
210+
211+
&:hover,
212+
&[aria-selected="true"] {
213+
background-color: var(--mx_SpotlightDialog_option_selectedBgColor, $quinary-content);
214+
}
215+
}
216+
196217
.mx_SpotlightDialog_recentlyViewed {
197218
> div {
198219
display: flex;
@@ -202,7 +223,6 @@ Please see LICENSE files in the repository root for full details.
202223
}
203224

204225
.mx_SpotlightDialog_option {
205-
border-radius: 8px;
206226
padding: $spacing-4;
207227
color: $primary-content;
208228
font-size: $font-12px;
@@ -213,8 +233,6 @@ Please see LICENSE files in the repository root for full details.
213233
min-width: 58px;
214234
box-sizing: border-box;
215235
text-align: center;
216-
overflow: hidden;
217-
text-overflow: ellipsis;
218236

219237
.mx_DecoratedRoomAvatar {
220238
margin: 0 9px $spacing-4; /* maintain centering */
@@ -223,11 +241,6 @@ Please see LICENSE files in the repository root for full details.
223241
& + .mx_SpotlightDialog_option {
224242
margin-left: $spacing-16;
225243
}
226-
227-
&:hover,
228-
&[aria-selected="true"] {
229-
background-color: $quinary-content;
230-
}
231244
}
232245
}
233246

@@ -236,17 +249,16 @@ Please see LICENSE files in the repository root for full details.
236249
.mx_SpotlightDialog_otherSearches,
237250
.mx_SpotlightDialog_hiddenResults {
238251
.mx_SpotlightDialog_option {
252+
--mx_SpotlightDialog_option_selectedBgColor: $system;
253+
239254
padding: 6px $spacing-4;
240-
border-radius: 8px;
241255
font-size: $font-15px;
242256
line-height: $font-24px;
243257
color: $primary-content;
244258
position: relative;
245259
display: flex;
246260
align-items: center;
247261
white-space: nowrap;
248-
text-overflow: ellipsis;
249-
overflow: hidden;
250262

251263
.mx_SpotlightDialog_option--endAdornment {
252264
display: inline-flex;
@@ -350,7 +362,7 @@ Please see LICENSE files in the repository root for full details.
350362
}
351363

352364
&:hover::before,
353-
&[aria-selected="true"]::before {
365+
&:focus-visible::before {
354366
background-color: $secondary-content;
355367
}
356368
}
@@ -361,8 +373,6 @@ Please see LICENSE files in the repository root for full details.
361373

362374
&:hover,
363375
&[aria-selected="true"] {
364-
background-color: $system;
365-
366376
.mx_SpotlightDialog_option--menu,
367377
.mx_SpotlightDialog_option--notifications {
368378
display: block;

0 commit comments

Comments
 (0)