[web] Fix keyboard popping up unexpectedly on iOS (flutter/engine#29246)

This commit is contained in:
Mouad Debbar
2021-10-20 14:21:43 +00:00
committed by GitHub
parent 359fa6cb98
commit 92a7a6b10f
2 changed files with 13 additions and 2 deletions

View File

@@ -97,9 +97,11 @@ class ShadowDomHostNode implements HostNode {
root.isConnected ?? true,
'The `root` of a ShadowDomHostNode must be connected to the Document object or a ShadowRoot.',
) {
_shadow = root.attachShadow(<String, String>{
_shadow = root.attachShadow(<String, dynamic>{
'mode': 'open',
'delegatesFocus': 'true',
// This needs to stay false to prevent issues like this:
// - https://github.com/flutter/flutter/issues/85759
'delegatesFocus': false,
});
final html.StyleElement shadowRootStyleElement = html.StyleElement();

View File

@@ -23,6 +23,15 @@ void testMain() {
expect(hostNode.node, isA<html.ShadowRoot>());
expect((hostNode.node as html.ShadowRoot).host, rootNode);
expect(hostNode.node, rootNode.shadowRoot);
// The shadow root should be initialized with correct parameters.
expect(rootNode.shadowRoot!.mode, 'open');
if (browserEngine != BrowserEngine.firefox &&
browserEngine != BrowserEngine.webkit) {
// Older versions of Safari and Firefox don't support this flag yet.
// See: https://caniuse.com/mdn-api_shadowroot_delegatesfocus
expect(rootNode.shadowRoot!.delegatesFocus, isFalse);
}
});
test('Attaches a stylesheet to the shadow root', () {