Skip to content

Commit a138477

Browse files
feat: add Ctrl+Space keyboard shortcut to open search widget (fixes #7631) (#7660)
* feat: add Ctrl+Space keyboard shortcut to open search widget (fixes #7631) * fix: apply prettier formatting * feat: make search widget draggable * fix: apply prettier formatting * fix: use capture phase for Ctrl+Space shortcut to open search widget * feat: improve search widget UI - capsule shape, centered position, drag support, close button * fix: remove duplicate Ctrl+Space handler and apply prettier formatting * fix: make classic search widget draggable to match helpfulSearchDiv * fix: sync search-controller.test.js with pre-refactor source and fix helpfulWheelDiv display bugs
1 parent 06aa181 commit a138477

4 files changed

Lines changed: 884 additions & 648 deletions

File tree

css/activities.css

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@ body:not(.dark):not(.highcontrast) #helpfulSearchDiv {
235235
transition: all 0.2s ease;
236236
margin-left: 8px;
237237
}
238+
#searchDragHandle {
239+
pointer-events: auto;
240+
}
238241

239242
#search:focus {
240243
border-color: var(--color-brand-primary-hover);
@@ -247,32 +250,46 @@ body:not(.dark):not(.highcontrast) #helpfulSearchDiv {
247250
}
248251

249252
#helpfulSearchDiv {
250-
display: block !important;
251-
position: absolute;
253+
position: fixed !important;
252254
background-color: var(--color-bg-secondary);
253-
padding: 2px;
255+
padding: 0;
254256
border: 1px solid var(--color-border-primary);
255-
width: 230px;
256-
z-index: 1;
257+
border-radius: 24px;
258+
width: 320px;
259+
z-index: 1000;
260+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
261+
height: 46px;
262+
overflow: hidden;
257263
}
258264

259265
#helpfulSearch {
260-
padding: 2px;
261-
border: 2px solid grey;
262-
width: 220px;
263-
height: 20px;
266+
padding: 0 40px 0 28px;
267+
border: none;
268+
width: 100%;
269+
height: 46px;
264270
font-size: large;
271+
background-color: transparent;
272+
color: inherit;
273+
outline: none;
274+
display: block;
275+
box-sizing: border-box;
265276
}
266277

267278
#crossButton {
268279
position: absolute;
269280
top: 50%;
270-
right: -30px;
281+
right: 10px;
271282
transform: translateY(-50%);
272-
background: transparent;
283+
background: rgba(80, 80, 80, 0.5);
273284
border: none;
274-
font-size: large;
285+
border-radius: 50%;
286+
width: 22px;
287+
height: 22px;
288+
color: white;
289+
font-size: 14px;
275290
cursor: pointer;
291+
line-height: 22px;
292+
text-align: center;
276293
}
277294

278295
.trash-view {

js/activity.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6341,6 +6341,18 @@ class Activity {
63416341

63426342
// Use managed addEventListener instead of onkeydown assignment
63436343
this.addEventListener(document, "keydown", this.handleKeyDown);
6344+
this.addEventListener(
6345+
document,
6346+
"keydown",
6347+
event => {
6348+
if ((event.ctrlKey || event.metaKey) && event.code === "Space") {
6349+
event.preventDefault();
6350+
event.stopImmediatePropagation();
6351+
this._displayHelpfulSearchDiv();
6352+
}
6353+
},
6354+
true
6355+
);
63446356

63456357
if (this.planet !== undefined) {
63466358
this.planet.planet.setAnalyzeProject(doAnalyzeProject);

0 commit comments

Comments
 (0)