Do not pass events to selectList children when they are not visible (#230)

This commit is contained in:
Francisco Vallarino 2022-11-21 09:53:14 -03:00 committed by GitHub
parent ff4ad25928
commit df6ae02edc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -341,6 +341,12 @@ makeSelectList widgetData items makeRow config state = widget where
| btn == wenv ^. L.mainButton -> result where
result = Just $ resultReqs node [SetFocus (node ^. L.info . L.widgetId)]
Click point _ _
| outsideVp point -> Just ignoreEvtResult
Move point
| outsideVp point -> Just ignoreEvtResult
Focus prev -> handleFocusChange node prev (_slcOnFocusReq config)
Blur next -> result where
@ -363,6 +369,10 @@ makeSelectList widgetData items makeRow config state = widget where
isSelectKey code = isKeyReturn code || isKeySpace code
_ -> Nothing
where
outsideVp point = not (pointInRect point (wenv ^. L.viewport))
ignoreEvtResult = resultReqs node [IgnoreChildrenEvents]
highlightNext wenv node = highlightItem wenv node nextIdx where
tempIdx = _hlIdx state
nextIdx