Skip to content

Commit f3af0b1

Browse files
Kateryna ProkopenkoDevtools-frontend LUCI CQ
authored andcommitted
Fix input text appearing on both sides in quick open
Bug: 403206050 Change-Id: Ie413092f4d7afa272c0f121029e3b9830da1984e Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6426043 Reviewed-by: Kim-Anh Tran <[email protected]> Auto-Submit: Kateryna Prokopenko <[email protected]> Commit-Queue: Kim-Anh Tran <[email protected]>
1 parent bb2e996 commit f3af0b1

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

front_end/ui/components/text_prompt/TextPrompt.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,22 @@ export class TextPrompt extends HTMLElement {
119119
return this.#input().value || '';
120120
}
121121

122+
connectedCallback(): void {
123+
const observer = new MutationObserver(mutations => {
124+
for (const mutation of mutations) {
125+
if (mutation.type === 'attributes' && mutation.attributeName === 'dir') {
126+
const writingDirection = this.#input().getAttribute('dir');
127+
if (!writingDirection) {
128+
this.#suggestion().removeAttribute('dir');
129+
return;
130+
}
131+
this.#suggestion().setAttribute('dir', writingDirection);
132+
}
133+
}
134+
});
135+
observer.observe(this.#input(), {attributeFilter: ['dir']});
136+
}
137+
122138
#render(): void {
123139
const output = html`
124140
<style>${textPromptStyles.cssText}</style>

0 commit comments

Comments
 (0)