Skip to content
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

**Feature:** Tree a11y #1168

Closed
wants to merge 7 commits into from
Closed

**Feature:** Tree a11y #1168

wants to merge 7 commits into from

Conversation

TejasQ
Copy link
Contributor

@TejasQ TejasQ commented Jul 30, 2019

Summary

This PR:

We:

  • add a focus state to tree
  • support onDoubleClick
  • make it keyboard accessible

Related issue

To be tested

Me

  • No new error or warning in the console on localhost:6060

Tester 1

  • Things look good on the demo.
  • Tree works as described in this PR and in the README.

Tester 2

  • Things look good on the demo.
  • Tree works as described in this PR and in the README.

@TejasQ TejasQ self-assigned this Jul 30, 2019
Copy link
Contributor

@mpotomin mpotomin left a comment

Choose a reason for hiding this comment

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

Looks nice! Only one small issue with keyboard controls and double click handler


Try it yourself!

- "Region" has a double click/<kbd>Enter</kbd> handler
Copy link
Contributor

@mpotomin mpotomin Jul 30, 2019

Choose a reason for hiding this comment

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

Region reacts to single "Enter" keystroke with the double-click handler for me. Hence, I also can not close/open that part of the tree with my keyboard (single clicking with mouse still works as expected though)

Screenshot 2019-07-30 at 09 34 56

Copy link
Contributor Author

@TejasQ TejasQ Jul 30, 2019

Choose a reason for hiding this comment

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

Space should handle expand and collapse, while enter triggers the “action” on double click. This is outlined in the README.md. 😉

I made sure to include it. https://github.com/contiamo/operational-ui/pull/1168/files#diff-da0c8b02385f203827104fc313ccb636R10

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps I could reword things to make them a little clearer. Or do you have an idea to make the behavior more like what you expect?

Copy link
Contributor

Choose a reason for hiding this comment

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

I have another question. The item "Legal Entity" right below the "Region" reacts to "Enter" key with opening/closing. It feels like a pretty inconsistent behaviour to me. I would expect to use Space key only everywhere for opening/closing the tree items, especially since there is no visual sing or marker, telling me, that "Region" has a handler for a double-click/enter attached. What's your take on this @TejasQ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Apart from the click/space/enter inconsistency, the rest looks good to me, I would leave it as it is 👍

Copy link
Contributor Author

@TejasQ TejasQ Jul 30, 2019

Choose a reason for hiding this comment

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

I think we could leave that up to the users. I'm also not that convinced about the behavior. It is currently:

  • if it's foldable, space toggles, enter double-clicks
    • if no double-click specified, enter falls back to click
      • if no click specified, #yolo

I totally understand what you're talking about but I figure we'll have an issue about it from a more concrete use case in the future if its truly confusing. I think it's a little hard to say at this stage.

@TejasQ TejasQ dismissed mpotomin’s stale review July 30, 2019 08:46

Changes requested on expected behavior.

@TejasQ TejasQ requested a review from mpotomin July 30, 2019 08:47
Copy link
Contributor

@mpotomin mpotomin left a comment

Choose a reason for hiding this comment

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

Such Tree! 🌳 Much items!

@stereobooster
Copy link
Contributor

Sometimes I get following behaviour on double click:

  • it collapse the tree
  • then alert
  • after alert it uncollapses the tree

Maybe a race condition or something

}
clickCount.current++
setTimeout(
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to cancel previous timeout before launching new one?

@TejasQ
Copy link
Contributor Author

TejasQ commented Jul 30, 2019

@stereobooster awesome. I think it's maybe that the timeout is not long enough. 😢 Unfortunately if I make it longer, the UX seems choppy. I don't really know how to solve it. I'll make an issue.

() => {
if (clickCount.current === 1) {
if (hasChildren) {
setIsOpen(!isOpen)
Copy link
Contributor

Choose a reason for hiding this comment

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

This theoretically can be triggered after component unmount, which will trigger the error

return
}
},
[onNodeContextMenu, onNodeDoubleClick, onNodeClick],
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
[onNodeContextMenu, onNodeDoubleClick, onNodeClick],
[onNodeContextMenu, onNodeDoubleClick, onNodeClick, onRemove],

we need linter for this

@fabien0102
Copy link
Contributor

Why unit-tests are not played on this PR 🤔 Is it new?

@fabien0102
Copy link
Contributor

image

The double click action fold the tree section for me (and expanded when I close the alert)

Copy link
Contributor

@fabien0102 fabien0102 left a comment

Choose a reason for hiding this comment

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

7d82efb2-694a-4f91-968b-f7a77da910ee

It's glitchy

@stereobooster
Copy link
Contributor

Side question: how do you trigger context menu with keyboard?

@TejasQ
Copy link
Contributor Author

TejasQ commented Jul 30, 2019

@stereobooster please read the PR (see highlighted line).

@TejasQ
Copy link
Contributor Author

TejasQ commented Jul 30, 2019

So there's no clear direction on how to handle use cases with both double click and right click behavior. I will close this and focus on other stuff until it makes sense to spend time here again.

@TejasQ TejasQ closed this Jul 30, 2019
@micha-f
Copy link
Member

micha-f commented Jul 30, 2019

@TejasQ We'll make figuring this out a priority. I'm sure some of this PR will live on 👍 .

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.

Listen for Double click on Tree Items Tree focus Tree is completely inaccessible
5 participants