Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit f650bca

Browse files
authored
Refactoring text editing. Strategy pattern is used to handle different browser/operating system and a11y behavior. (#14131)
* adding the default text editing strategy * [DRAFT] Refactoring text editing. Strategy pattern is used to handle different browser/operating system and a11y behaviour. Unit tests are missing. Documentation needs updating. * addressing PR comments * addressing PR comments. Fixing documentation * fixing persistenttextediting element which is used in a11y mode * removing texteditingelement and using texteditingstrategy from hybridtextediting. fixing the unit tests. fixing comments * fix unit tests * add todos for firefox tests * fixing chrome/android a11y issue
1 parent d8edfea commit f650bca

File tree

4 files changed

+556
-376
lines changed

4 files changed

+556
-376
lines changed

lib/web_ui/lib/src/engine/browser_detection.dart

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,23 @@ enum BrowserEngine {
2929
/// Lazily initialized current browser engine.
3030
BrowserEngine _browserEngine;
3131

32+
/// Override the value of [browserEngine].
33+
///
34+
/// Setting this to `null` lets [browserEngine] detect the browser that the
35+
/// app is running on.
36+
///
37+
/// This is intended to be used for testing and debugging only.
38+
BrowserEngine debugBrowserEngineOverride;
39+
3240
/// Returns the [BrowserEngine] used by the current browser.
3341
///
3442
/// This is used to implement browser-specific behavior.
35-
BrowserEngine get browserEngine => _browserEngine ??= _detectBrowserEngine();
43+
BrowserEngine get browserEngine {
44+
if (debugBrowserEngineOverride != null) {
45+
return debugBrowserEngineOverride;
46+
}
47+
return _browserEngine ??= _detectBrowserEngine();
48+
}
3649

3750
BrowserEngine _detectBrowserEngine() {
3851
final String vendor = html.window.navigator.vendor;

lib/web_ui/lib/src/engine/text_editing/input_type.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ abstract class EngineInputType {
6666
html.HtmlElement createDomElement() => html.InputElement();
6767

6868
/// Given a [domElement], set attributes that are specific to this input type.
69-
void configureDomElement(html.HtmlElement domElement) {
69+
void configureInputMode(html.HtmlElement domElement) {
7070
if (inputmodeAttribute == null) {
7171
return;
7272
}

0 commit comments

Comments
 (0)