-
Notifications
You must be signed in to change notification settings - Fork 55
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
feat(ObjectViewer): improve a11y #1616
Conversation
1 similar comment
1 similar comment
1 similar comment
1 similar comment
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 have covered the treeview part.
Don t forget to check the console in the storybook i have lots of JS Error
case keycode.codes.end: | ||
focusOn(event, getLastItem(ref)); | ||
break; | ||
case keycode.codes['numpad *']: |
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.
it doesn t work with *
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.
Fixed it, but I need to test the key, not the keyCode. Depending on the keyboard, the keyCode is different :/
|
||
TreeGesture.propTypes = { | ||
...omit(WrappedComponent.propTypes, 'onKeyDown'), | ||
onToggleAllSiblings: PropTypes.func.isRequired, |
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.
onSelect and onToggle are used and required (in your code)
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.
Added
break; | ||
default: | ||
break; | ||
} |
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.
please add support for this.props.onKeyDown
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.
No there is no need. If the need comes, it's easy to add it, but adding a feature in case someone needs it is not a good idea IMO
@@ -0,0 +1,162 @@ | |||
import React from 'react'; |
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.
it s a function so please name the file withTreeGesture (like connect)
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.
Changed the file name
|
||
const treeProps = { | ||
items: [ | ||
{ id: 0 }, // 0 0 |
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.
sorry I don t understand those comments ( // 1 0)
Looks like battleships coordinates :)
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.
They are coordinates :D
Those are level / index. It's easier to understand with those while reading some tests. I'll add a legend
|
||
onToggleAllSiblings(event, items) { | ||
event.stopPropagation(); | ||
return this.props.onToggleAllSiblings(event, items); |
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.
you have hide event.stopPropagation in every handler.
I found that makes the readability quite hard.
What do you think about:
call event.stopPropagation in onKeyDown when the key is handled and call the associated effect.
the focusOn should not stop propagation but just call focus if element exists.
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.
Done
], | ||
}, // 0 1 | ||
{ id: 2 }, // 0 2 | ||
{ id: 3 }, // 0 3 |
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.
not sure if we should keep those comments
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 added the legend
1 similar comment
}; | ||
const wrapper = mount(<ComponentWithGesture {...props} />); | ||
const event = { | ||
keyCode: keycode.codes['numpad *'], |
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.
this is wrong, the code use the native event, not the numpad, so why it 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.
Removed
@@ -154,6 +154,7 @@ const defaultProps = { | |||
structure, | |||
onSelect: action('onSelect'), | |||
onToggle: action('onToggle'), | |||
onToggleAllSiblings: action('onToggleAllSiblings'), |
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.
👍
1 similar comment
This reverts commit 99ba3f3.
What is the problem this PR is trying to solve?
Table mode
JSON mode
What is the chosen solution to this problem?
Table mode
JSON mode (refacto)
Please check if the PR fulfills these requirements
[x] This PR introduces a breaking change
This impacts only the component. If you use the cmf container, it works as expected.
props.onMouseOver
props.onSelect(event, jsonpath)
props.onSelect(event, { jsonpath })
props.onToggleAllSiblings(event, siblings)
*
keydown to expand all the nodes at the same levelBefore
After