summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaladox none <thomasmulhall410@yahoo.com>2025-10-31 07:29:39 -0700
committerPaladox none <thomasmulhall410@yahoo.com>2025-11-12 05:26:45 -0800
commit46f2be98bbea3cbe78dd68ed4c8f978ef0244044 (patch)
tree89909631b45bce1d4423f56f2090b7b54f705daf
parent722d48b8a1eacc0e3a6aabc4d3f286e87999c6dd (diff)
Fix using plaintext-only on firefox in gr-textareaupstream/stable-3.11
I managed to create a reproducable case in [0]. Using just js and html. Adding an empty <div> after <div> fixed it. [0] https://bugzilla.mozilla.org/show_bug.cgi?id=1989935 Release-Notes: Fix using plaintext-only on firefox in gr-textarea Change-Id: Ib0075efbb696fc9f0fd3831e63eb536e6dd1b654 (cherry picked from commit f38985a46a0c0de6270bcb65e1dfe3d099929cd2)
-rw-r--r--polygerrit-ui/app/embed/gr-textarea.ts38
1 files changed, 20 insertions, 18 deletions
diff --git a/polygerrit-ui/app/embed/gr-textarea.ts b/polygerrit-ui/app/embed/gr-textarea.ts
index 0a73823451..8044c516eb 100644
--- a/polygerrit-ui/app/embed/gr-textarea.ts
+++ b/polygerrit-ui/app/embed/gr-textarea.ts
@@ -14,7 +14,7 @@ import {
HintDismissedEventDetail,
CursorPositionChangeEventDetail,
} from '../api/embed';
-import {isFirefox, isSafari} from '../utils/dom-util';
+import {isSafari} from '../utils/dom-util';
/**
* Waits for the next animation frame.
@@ -267,22 +267,24 @@ export class GrTextarea extends LitElement implements GrTextareaApi {
// which prevents HTML from being inserted into a contenteditable element.
// https://github.com/w3c/editing/issues/162
return html`<div
- aria-disabled=${this.disabled}
- aria-multiline="true"
- aria-placeholder=${ifDefined(ariaPlaceholder)}
- data-placeholder=${ifDefined(placeholder)}
- class=${classes}
- contenteditable=${this.contentEditableAttributeValue}
- dir="ltr"
- role="textbox"
- @input=${this.onInput}
- @focus=${this.onFocus}
- @blur=${this.onBlur}
- @keydown=${this.handleKeyDown}
- @keyup=${this.handleKeyUp}
- @mouseup=${this.handleMouseUp}
- @scroll=${this.handleScroll}
- ></div>`;
+ aria-disabled=${this.disabled}
+ aria-multiline="true"
+ aria-placeholder=${ifDefined(ariaPlaceholder)}
+ data-placeholder=${ifDefined(placeholder)}
+ class=${classes}
+ contenteditable=${this.contentEditableAttributeValue}
+ dir="ltr"
+ role="textbox"
+ @input=${this.onInput}
+ @focus=${this.onFocus}
+ @blur=${this.onBlur}
+ @keydown=${this.handleKeyDown}
+ @keyup=${this.handleKeyUp}
+ @mouseup=${this.handleMouseUp}
+ @scroll=${this.handleScroll}
+ ></div>
+ <!-- Required for firefox to use plaintext-only above. -->
+ <div></div>`;
}
/**
@@ -415,7 +417,7 @@ export class GrTextarea extends LitElement implements GrTextareaApi {
private get contentEditableAttributeValue() {
return this.disabled
? 'false'
- : !isFirefox() && this.isPlaintextOnlySupported
+ : this.isPlaintextOnlySupported
? ('plaintext-only' as unknown as 'true')
: 'true';
}