You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ad591d1
Browse filesBrowse the repository at this point in the historyBrowse files
fix: respect disabled parent when syncing client disabled state (#10023)
## Description
`DisableOnClickController` forces the client-side `disabled` property
from `setEnabled`, because Flow does not send a change when a component
is disabled and re-enabled in the same round trip. It used the value
passed to `setEnabled`, so enabling a button under a disabled parent
cleared `disabled` on the client while the server kept rejecting clicks.
- Changed `DisableOnClickController.onSetEnabled()` to schedule the
client update with `beforeClientResponse` and read the effective enabled
state at that point, so a disabled parent keeps the component disabled
on the client
- Coalesced repeated `setEnabled` calls in one round trip into a single
client update
- Deferred the update until the component is attached instead of
queueing a JavaScript call per `setEnabled` call while detached
- Removed the unused `enabled` parameter from `onSetEnabled()` and
updated `Button` and `MenuItemBase`
- Added unit tests for the disabled parent, same round trip, and
detached cases
## Type of change
- Bugfix
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: vaadin-context-menu-flow-parent/vaadin-context-menu-flow/src/main/java/com/vaadin/flow/component/contextmenu/MenuItemBase.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -280,7 +280,7 @@ public boolean isDisableOnClick() {
Copy file name to clipboardExpand all lines: vaadin-flow-components-shared-parent/vaadin-flow-components-base/src/main/java/com/vaadin/flow/component/shared/internal/DisableOnClickController.java
+24-10Lines changed: 24 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -46,6 +46,7 @@ public class DisableOnClickController<C extends Component & HasEnabled>
46
46
47
47
privatefinalCcomponent;
48
48
privatebooleandisableOnClick = false;
49
+
privatebooleanclientUpdateScheduled = false;
49
50
50
51
/**
51
52
* Creates a new controller for the given component.
@@ -57,6 +58,8 @@ public class DisableOnClickController<C extends Component & HasEnabled>
Copy file name to clipboardExpand all lines: vaadin-flow-components-shared-parent/vaadin-flow-components-base/src/test/java/com/vaadin/flow/component/shared/DisableOnClickControllerTest.java
0 commit comments