Skip to content

Commit 56f11d9

Browse files
jjaegglirebornix
andauthored
Add dialog role to editor find widget (microsoft#172979)
* Add aria role + label to dialog. Close bttn last. * Stash current css layout changes. * Pixel perfect layout. Update close button selector * Uncomment line. Add localization for dialog label. * Remove unnecessary newlines. * Move in DOM to maintain existing focus order. --------- Co-authored-by: Peng Lyu <[email protected]>
1 parent d4f29ca commit 56f11d9

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/vs/editor/contrib/find/browser/findWidget.css

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
.monaco-editor .find-widget > .find-part,
5757
.monaco-editor .find-widget > .replace-part {
58-
margin: 3px 0 0 17px;
58+
margin: 3px 25px 0 17px;
5959
font-size: 12px;
6060
display: flex;
6161
}
@@ -228,3 +228,10 @@
228228
top: 1px;
229229
left: 2px;
230230
}
231+
232+
/* Close button position. */
233+
.monaco-editor .find-widget > .button.codicon-widget-close {
234+
position: absolute;
235+
top: 5px;
236+
right: 4px;
237+
}

src/vs/editor/contrib/find/browser/findWidget.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export interface IFindController {
5959
getGlobalBufferTerm(): Promise<string>;
6060
}
6161

62+
const NLS_FIND_DIALOG_LABEL = nls.localize('label.findDialog', "Find / Replace");
6263
const NLS_FIND_INPUT_LABEL = nls.localize('label.find', "Find");
6364
const NLS_FIND_INPUT_PLACEHOLDER = nls.localize('placeholder.find', "Find");
6465
const NLS_PREVIOUS_MATCH_BTN_LABEL = nls.localize('label.previousMatchButton', "Previous Match");
@@ -1093,8 +1094,6 @@ export class FindWidget extends Widget implements IOverlayWidget, IVerticalSashL
10931094
}
10941095
}));
10951096

1096-
actionsContainer.appendChild(this._closeBtn.domNode);
1097-
10981097
// Replace input
10991098
this._replaceInput = this._register(new ContextScopedReplaceInput(null, undefined, {
11001099
label: NLS_REPLACE_INPUT_LABEL,
@@ -1193,11 +1192,15 @@ export class FindWidget extends Widget implements IOverlayWidget, IVerticalSashL
11931192
this._domNode = document.createElement('div');
11941193
this._domNode.className = 'editor-widget find-widget';
11951194
this._domNode.setAttribute('aria-hidden', 'true');
1195+
this._domNode.ariaLabel = NLS_FIND_DIALOG_LABEL;
1196+
this._domNode.role = 'dialog';
1197+
11961198
// We need to set this explicitly, otherwise on IE11, the width inheritence of flex doesn't work.
11971199
this._domNode.style.width = `${FIND_WIDGET_INITIAL_WIDTH}px`;
11981200

11991201
this._domNode.appendChild(this._toggleReplaceBtn.domNode);
12001202
this._domNode.appendChild(findPart);
1203+
this._domNode.appendChild(this._closeBtn.domNode);
12011204
this._domNode.appendChild(replacePart);
12021205

12031206
this._resizeSash = new Sash(this._domNode, this, { orientation: Orientation.VERTICAL, size: 2 });

0 commit comments

Comments
 (0)