Fixing selection issues in Firefox (flutter/engine#12793)

* Fixing selection issues in Firefox. Moving text editing dom elements to glass pane.

* Addressing PR comments.

* Update text_editing.dart

fixing typo
This commit is contained in:
Nurhan Turgut
2019-10-04 11:58:32 -07:00
committed by GitHub
parent 7bcb751f24
commit 02a9d61d47
2 changed files with 9 additions and 1 deletions

View File

@@ -341,6 +341,10 @@ class TextEditingElement {
_subscriptions.add(domElement.onKeyUp.listen((event) {
_handleChange(event);
}));
/// In Firefox the context menu item "Select All" does not work without
/// listening to onSelect. On the other browsers onSelectionChange is
/// enough for covering "Select All" functionality.
_subscriptions.add(domElement.onSelect.listen(_handleChange));
} else {
_subscriptions.add(html.document.onSelectionChange.listen(_handleChange));
}
@@ -379,7 +383,7 @@ class TextEditingElement {
throw UnsupportedError(
'Unsupported input type: ${inputConfig.inputType}');
}
html.document.body.append(domElement);
domRenderer.glassPaneElement.append(domElement);
}
void _removeDomElement() {

View File

@@ -75,6 +75,10 @@ void main() {
expect(document.activeElement, input);
expect(editingElement.domElement, input);
// Input is appended to the glass pane.
expect(domRenderer.glassPaneElement.contains(editingElement.domElement),
isTrue);
editingElement.disable();
expect(
document.getElementsByTagName('input'),