Skip to content

Conversation

pleszkiewicz
Copy link
Contributor

This PR solves the problem with DropdownList when embedded in any Layout container. After opening the dropdown list, any item cannot be selected because all events are handled by parent component (layout).
To solve this, we introduced FocusIntersecting protocol.

Closes #614 and magic-script/magic-script-components#336

}

// Check hit test in a standard way
var hitResults: [HitTestResult] = []
let topNodes: [BaseNode] = rootNode.childNodes.compactMap { $0 as? BaseNode }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this code ever but hit? I think it will only be hit if focusInterceptedNodes is empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the goal of this code:

  • if there is any component which has intercepted the focus (ex. dropdown List is showing its list), then return that component (so that it can handle the input: either select list item or dismiss the list)
  • else do standard hitTest

@pleszkiewicz pleszkiewicz merged commit 2a4eb5f into master Dec 17, 2020
@pleszkiewicz pleszkiewicz deleted the improve/dropdown_list_in_layout branch December 17, 2020 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DropdownItem cannot be selected if Dropdown is embedded in Layout component.
2 participants