-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: keyboard interaction for popover #793
Conversation
|
Deploy preview for fundamental-react ready! Built with commit bc64b61 |
src/utils/_Popper.js
Outdated
@@ -88,6 +88,7 @@ class Popper extends React.Component { | |||
|
|||
let popper = ( | |||
<ReactPopper | |||
{...popperProps} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
innerRef
could not be set without the props going to this level because it only exists in react-popper
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might need an additional prop then to spread to the inner div
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to just separate the ref out from the popperProps
. Don't think there would be a need to have two sets of props to spread.
The combobox can't be navigated into with the arrow key. Is this due to keyboard issues of the list inside or can we fix this here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, QA completed and now the keyboard handling is up to spec.
I have a question – and a comment. :) Fundamental Vue also has a Popover-component. I also thought about where to add things like keyboard-handling, trapping, … and in the end (at least as of now) I decided to not implement those things in the Popover component itself. Those kind of things are implemented in the components that use the popover component. The reason was the realization that this makes it more straight forward to re-use the popover component for a multitude of other things. For example I am also using the popover for popovers that are shown "on hover" and in that case I don't want any focus trapping to happen – also What are your thoughts on this? Maybe I am also over-engineering things… :D |
@ChristianKienle Good points. 🙂 I think this boils down to what a But this isn't consistent, as react-bootstrap uses tooltips that need to be activated as well, with the main differentiation from its popover being the styling. We don't really have a |
@jacobdevera Take the date-input + calendar component as an example. In Fundamental Vue this component is simply using the popover component + a date input component + the calendar. Once you click on the input the calendar appears. While the calendar is open you still want to be able to use the input (typing in a data + using the arrow keys + esc). Isn't that a use case where you would have to "turn off" almost every special keyboard-handling + focus trapping code? The popover in Fundamental Vue is really just a div that is rendered on top of everything else + managed by popper.js. There are special components that simply re-use the popover component but add "domain specific" things like keyboard handling, focus trapping + auto dismiss when the user interacts with elements outside of the popover. The popover component in Fundamental Vue does not even "dismiss itself" when the user starts to interact with something outside of it. One of the reasons is the above date picker. You want the user to interact with the input element while the popover is open. :D When I realized that I first began to add props to the (back then – much smarter) popover component that could be used to toggle those features on and off. In the end I almost always had to play with those props because every time I tried to re-use the smart popover something did not feel right. This was the point when I said to myself: "Hey – I am turning off features every time I use this component – why don't I just remove all those features then and add them later (in other components that are part of the library) where they belong to?. Then I made that change and it felt good. But I guess you are right – there is no "right" and "wrong" and definitive way to do things here. :D Also I should mention that one part of me feels my approach is way too over engineered – it somehow makes sense in my head but is not really intuitive because you have other expectations when you hear "popover". |
Description