SplitButton: Both action button and action item are executed
See original GitHub issueDescribe the defect
The core refactoring of @Rapster (#5009) introduced a bug to p:splitbutton
and maybe to other components (did not check it).
Before the code changes the logic of super.decode()
was inside an if block and the code below was inside an else-if block (see here).
That means, that both action listeners will be executed. The one of the menu item in super.decode()
and the one from the standalone if block. But only the one of the menu item should be executed if a menu item was clicked.
This seems to happen only to a splitbutton that uses the model
attribute.
Reproducer https://github.com/fanste/primefaces-test/tree/test-6192
Environment:
- PF Version: 8.0
- JSF + version: Mojarra 2.1.19
- Affected browsers: ALL
To Reproduce Steps to reproduce the behavior:
- Go to ‘index.jsf’
- Click on ‘ALL’
- Only the ALL action listener is executed
- Click on any menu item of the split button
- Action listener of ALL and menu item is executed
Expected behavior Already explained in the defect description
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (8 by maintainers)
That was a short debug session 😄
Static
p:menuItem
will be handled by UIMenuItem itself while the dynamic one will be handled by the SplitButton. The proposed fix should be the correct way.Let
MenuItemAwareRenderer#decode
returntrue/false
andSplitButtonRenderer#decode
should handle that return value.Thanks for the PR. I can confirm, that everything is working now.