diff --git a/integration_tests/snapshots/dom/elements/input.ts.88ab73881.png b/integration_tests/snapshots/dom/elements/input.ts.88ab73881.png new file mode 100644 index 0000000000..edcda5d62b Binary files /dev/null and b/integration_tests/snapshots/dom/elements/input.ts.88ab73881.png differ diff --git a/integration_tests/specs/dom/elements/input.ts b/integration_tests/specs/dom/elements/input.ts index f530a2ed3e..f08d47246d 100644 --- a/integration_tests/specs/dom/elements/input.ts +++ b/integration_tests/specs/dom/elements/input.ts @@ -595,4 +595,23 @@ describe('Tags input', () => { done(); }); }); + + it('should works when change display on input element', (done) => { + const input = createElement('input', { + style: { + width: '50px' + } + }, []); + document.body.appendChild(input); + document.body.appendChild(createElement('span', {}, [createText('AAAAA')])) + + requestAnimationFrame(async() => { + input.style.display = 'inline-block'; + requestAnimationFrame((() => { + + })) + await snapshot(); + done(); + }); + }); }); diff --git a/webf/lib/src/widget/widget_element.dart b/webf/lib/src/widget/widget_element.dart index 1b12b36475..7c1e470e0b 100644 --- a/webf/lib/src/widget/widget_element.dart +++ b/webf/lib/src/widget/widget_element.dart @@ -84,10 +84,11 @@ abstract class WidgetElement extends dom.Element { @override void willAttachRenderer() { super.willAttachRenderer(); - if (renderStyle.display != CSSDisplay.none) { + if (renderStyle.display != CSSDisplay.none && attachedAdapter == null) { attachedAdapter = WebFWidgetElementToWidgetAdapter(child: widget, container: renderBoxModel!, widgetElement: this); } } + @mustCallSuper @override void didAttachRenderer() {