Skip to content

Commit

Permalink
fix: fix assertion error when change display in input element.
Browse files Browse the repository at this point in the history
  • Loading branch information
andycall authored and yifei8 committed Nov 27, 2023
1 parent e9b8efa commit c8b8813
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions integration_tests/specs/dom/elements/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
});
3 changes: 2 additions & 1 deletion webf/lib/src/widget/widget_element.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit c8b8813

Please sign in to comment.