Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dialog role to editor find widget #172979

Merged
merged 8 commits into from
Jun 6, 2023
Merged
9 changes: 8 additions & 1 deletion src/vs/editor/contrib/find/browser/findWidget.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

.monaco-editor .find-widget > .find-part,
.monaco-editor .find-widget > .replace-part {
margin: 3px 0 0 17px;
margin: 3px 25px 0 17px;
font-size: 12px;
display: flex;
}
Expand Down Expand Up @@ -228,3 +228,10 @@
top: 1px;
left: 2px;
}

/* Close button position. */
.monaco-editor .find-widget > .button.codicon-widget-close {
position: absolute;
top: 5px;
right: 4px;
}
7 changes: 5 additions & 2 deletions src/vs/editor/contrib/find/browser/findWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export interface IFindController {
getGlobalBufferTerm(): Promise<string>;
}

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

actionsContainer.appendChild(this._closeBtn.domNode);

// Replace input
this._replaceInput = this._register(new ContextScopedReplaceInput(null, undefined, {
label: NLS_REPLACE_INPUT_LABEL,
Expand Down Expand Up @@ -1193,11 +1192,15 @@ export class FindWidget extends Widget implements IOverlayWidget, IVerticalSashL
this._domNode = document.createElement('div');
this._domNode.className = 'editor-widget find-widget';
this._domNode.setAttribute('aria-hidden', 'true');
this._domNode.ariaLabel = NLS_FIND_DIALOG_LABEL;
this._domNode.role = 'dialog';

// We need to set this explicitly, otherwise on IE11, the width inheritence of flex doesn't work.
this._domNode.style.width = `${FIND_WIDGET_INITIAL_WIDTH}px`;

this._domNode.appendChild(this._toggleReplaceBtn.domNode);
this._domNode.appendChild(findPart);
this._domNode.appendChild(this._closeBtn.domNode);
this._domNode.appendChild(replacePart);

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