ui5-webcomponents
ui5-webcomponents copied to clipboard
SegmentedButton: wrong `selectedItem` if `mouseup` is fired on different `SegmentedButtonItem` than `mousedown`
Bug Description
If the left mouse button is pressed but not released on a SegmentedButtonItem
and then the cursor is moved to another SegmentedButtonItem
no item is selected anymore. This is because the SegmentedButton
receives the wrong target
in this case.
https://github.com/SAP/ui5-webcomponents/blob/03269f45859ae2d0c17686ebf21cb10ff9de35cb/packages/main/src/SegmentedButton.js#L214
Steps to Reproduce
- Go to codeSandbox
- Move the cursor over one of the
SegmentedButtonItems
- Press but don't release the left mouse button
- Move to another item an release the left mouse button
- See that no element is selected and the
selectedItem
isslot
(and also anItemNavigation
warning is fired)
Isolated Example
https://codesandbox.io/s/jolly-feather-4c7wko?file=/src/App.js
https://user-images.githubusercontent.com/9749730/174804612-3ed4e87a-8ec1-4345-b3dd-ec2d63f5152d.mp4
Context
- UI5 Web Components version: 1.4.0
Priority
- [ ] Low
- [x] Medium
- [ ] High
- [ ] Very High
Stakeholder Info (if applicable)
- Organization: UI5 Web Components for React