segmentio / evergreen

🌲 Evergreen React UI Framework by Segment
https://evergreen.segment.com
MIT License
12.39k stars 832 forks source link

SelectMenu closes on click when it shouldnt #1200

Closed psiho closed 3 years ago

psiho commented 3 years ago

I upgraded my react 16.13.1 app to evergreeui6 and now my SelectMenu behaves weird. Menu closes:

I don't even know where to start debugging :) WIll try to create a code to reproduce it.

thiagomdo1 commented 3 years ago

Same issue here when I click anywhere on the Popover component.

The click event leads me to this block of code (Popover.js):


const handleBodyClick = useCallback(
    event => {
      // Ignore clicks on the popover or button
      if (targetRef.current && targetRef.current.contains(event.target)) {
        return
      }
      if (shouldCloseOnExternalClick !== false) {
        close()
      }
    },
    [onBodyClick, shouldCloseOnExternalClick, close, targetRef.current, popoverNode.current]
  )

No matter where I click, it always triggers that close() function.

akleiner2 commented 3 years ago

Thanks for reporting - fix is here: https://github.com/segmentio/evergreen/pull/1199. Will cut a patch release today or tomorrow! Thank you for your patience.

akleiner2 commented 3 years ago

Should be fixed in 6.0.1!

akleiner2 commented 3 years ago

Closing this out, but let me know if this is still an issue.