ui5-webcomponents icon indicating copy to clipboard operation
ui5-webcomponents copied to clipboard

SegmentedButton: wrong `selectedItem` if `mouseup` is fired on different `SegmentedButtonItem` than `mousedown`

Open Lukas742 opened this issue 2 years ago • 0 comments

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

  1. Go to codeSandbox
  2. Move the cursor over one of the SegmentedButtonItems
  3. Press but don't release the left mouse button
  4. Move to another item an release the left mouse button
  5. See that no element is selected and the selectedItem is slot (and also an ItemNavigation 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

Lukas742 avatar Jun 21 '22 13:06 Lukas742