-
Notifications
You must be signed in to change notification settings - Fork 15
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
ENH Improve keyboard support #200
ENH Improve keyboard support #200
Conversation
1e145aa
to
1de49b9
Compare
@@ -42,7 +49,6 @@ const section = 'SilverStripe\\LinkField\\Controllers\\LinkFieldController'; | |||
const LinkField = ({ | |||
value = null, | |||
onChange, | |||
onNonPublishedVersionedState, |
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 unrelated refactoring to remove a non-existant prop
import { arrayMove, SortableContext, verticalListSortingStrategy } from '@dnd-kit/sortable'; | ||
import { restrictToVerticalAxis, restrictToParentElement } from '@dnd-kit/modifiers'; | ||
import { injectGraphql } from 'lib/Injector'; |
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 unrelated refactoring to remove an unused import
left: 5px; | ||
position: absolute; | ||
z-index: 100; | ||
|
||
&:hover { | ||
cursor: grab; | ||
} | ||
|
||
.font-icon-drag-handle { | ||
opacity: 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.
Using opacity instead of display so that it can be tabbed to
96e9f0e
to
d08a599
Compare
@@ -108,15 +143,7 @@ const LinkPickerTitle = ({ | |||
role="button" | |||
tabIndex="0" | |||
className="link-picker__delete btn btn-link" | |||
onKeyDown={(evt) => { |
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 unrelated refactoring, moved to handleDeleteKeyDown()
} | ||
}; | ||
|
||
const handleDeleteKeyDown = (event) => { |
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 unrelated refactoring, was previously an inline method in render() for onKeyDown
17cc97b
to
66e8f94
Compare
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, works perfect. Just tiny possible improvements.
{ (isMulti && !readonly && !disabled) && <div className="link-picker__drag-handle"> | ||
<i | ||
className="font-icon-drag-handle" | ||
tabIndex="0" | ||
role="button" | ||
aria-pressed="false" | ||
aria-controls={idAttr} | ||
onKeyDown={handleIconKeyDown} | ||
></i> | ||
</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.
{ (isMulti && !readonly && !disabled) && <div className="link-picker__drag-handle"> | |
<i | |
className="font-icon-drag-handle" | |
tabIndex="0" | |
role="button" | |
aria-pressed="false" | |
aria-controls={idAttr} | |
onKeyDown={handleIconKeyDown} | |
></i> | |
</div> } | |
{ (isMulti && !readonly && !disabled) && <div className="link-picker__drag-handle" | |
tabIndex="0" | |
role="button" | |
aria-pressed="false" | |
aria-controls={idAttr} | |
aria-label="Sort Links" | |
onKeyDown={handleIconKeyDown} | |
> | |
<i | |
className="font-icon-drag-handle" | |
aria-hidden="true" | |
focusable="false" | |
></i> | |
</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.
Probably, would be better to use as a button div
element instead of icon
.
And also, please, add aria-label="Sort Links"
since this element doesn't have any content that explains what this button does.
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.
Updated
bd7ecb5
to
52c3908
Compare
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.
@emteknetnz, could you please fix this one as well https://github.com/silverstripe/silverstripe-linkfield/pull/200/files#r1483616400
52c3908
to
edbbf5a
Compare
edbbf5a
to
fac2d31
Compare
@sabina-talipova Have updated |
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.
LGTM. Test locally, works perfect.
Issue #99
Does the following:
Jest testing proved extremely hard so I haven't done much of it in this PR. I switched to using React Testing Library userEvent though it still didn't behave like a browser, for instance:
onclick
handler which is triggered when doing the same in an actual browserNew issue for behat keyboard sorting: