-
Notifications
You must be signed in to change notification settings - Fork 75
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
Pages Editor: add "Add New Task" Dialog #6915
Conversation
Add a new Task + | ||
</button> | ||
<dialog | ||
autofocus="true" |
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.
autofocus="true" | |
autoFocus |
This is why you're getting ESLint warnings.
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.
Don't focus the dialog itself by the way.
Focus the first focusable element or the first heading.
The WAI-ARIA dialog example has some discussion of this.
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.
Is this dialog supposed to be modal, by the way?
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.
Ignore me, I just saw that you're using showModal()
. 👍
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.
The autofocus thing here is an odd one - I think I'll just delete it altogether since adding/removing autofocus="true"
has no effect on the UI/UX (on macOS + Chrome 119/FF 119/Safari 15). i.e. the first interactable element (i.e. the close button) always gets focus on showModal() anyway. 🤨
Other misc dev notes:
autofocus="true"
in React renders as<dialog autofocus="true">...</dialog>
in the HTMLautofocus
,autofocus={true}
,autoFocus
,autoFocus={true}
, andautoFocus="true"
will all just render as<dialog>...</dialog>
- I wondered if this is just a quirk with me adding autofocus to
<dialog>
instead of a proper interactable element, so I tried...<dialog> <input type="text" defaultValue="this is just a distraction" /> <input type="text" defaultValue="this should get focus when modal opens" autofocus="true" /> </dialog>
- ...and the ONLY time that the second text input gets focus on .showModal() is with
autofocus="true"
. autoFocus doesn't work, despite React saying it should. - Maybe this is a quirk with React 17? I don't know, but I'm making a note of it just in case.
PR UpdateChange of plans for this PR:
Other than that, all intended behaviour has been implemented in this PR. Testing
Video: example of intended behaviour. (macOS + Chrome) Screen.Recording.2023-11-10.at.22.01.40.movStatusReady for review! |
5b2e469
to
6e6b0c0
Compare
583f7ff
to
06f386a
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, but the FontAwesome icons need to either add support for alt text or remove role='img'
.
onClick={openNewTaskDialog} | ||
type="button" | ||
> | ||
Add a new Task + |
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.
Pedantic point, but maybe add the '+' with ::after
, to give a more natural button label.
<button | ||
className="plain" | ||
onClick={closeNewTaskDialog} | ||
type="button" | ||
> | ||
<CloseIcon /> | ||
</button> |
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 button has no label. That's a level A accessibility failure.
|
||
export default function CloseIcon() { | ||
return ( | ||
<span className="icon fa fa-close" role="img" /> |
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.
If this is supposed to be an image, it should allow for alt text to be passed in as an aria-label
prop. All images must have alt text. If not, then remove the role='img'
.
export default function CloseIcon() { | ||
return ( | ||
<span className="icon fa fa-close" role="img" /> | ||
); | ||
} |
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.
export default function CloseIcon() { | |
return ( | |
<span className="icon fa fa-close" role="img" /> | |
); | |
} | |
export default function CloseIcon({ ariaLabel = '' }) { | |
return ( | |
<span className="icon fa fa-close" role="img" aria-label={ariaLabel} /> | |
); | |
} |
Something like this might work.
|
||
export default function CopyIcon() { | ||
return ( | ||
<span className="icon fa fa-copy" role="img" /> |
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.
Missing alt text for this image. Either add alt text or remove role='img'
.
|
||
export default function DeleteIcon() { | ||
return ( | ||
<span className="icon fa fa-trash" role="img" /> |
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.
Missing alt text for this image. Either add alt text or remove role='img'
.
|
||
export default function EditIcon() { | ||
return ( | ||
<span className="icon fa fa-pencil" role="img" /> |
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.
Missing alt text for this image. Either add alt text or remove role='img'
.
|
||
export default function MoveDownIcon() { | ||
return ( | ||
<span className="icon fa fa-caret-down" role="img" /> |
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.
Missing alt text for this image. Either add alt text or remove role='img'
.
|
||
export default function MoveUpIcon() { | ||
return ( | ||
<span className="icon fa fa-caret-up" role="img" /> |
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.
Missing alt text for this image. Either add alt text or remove role='img'
.
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! Strong suggestion to add alt-text to all the images for accessibility benefits.
06f386a
to
3a0cdf0
Compare
Thanks everyone! I've incorporated the feedback into the latest update. PR Update
Let's go! |
d5e91ba
to
f09b9c8
Compare
f09b9c8
to
7ace391
Compare
PR Overview
Part of: Pages Editor MVP project and FEM Lab super-project
Follow #6898
Staging branch URL: https://pr-6915.pfe-preview.zooniverse.org/lab/1982/workflows/editor/3711?env=staging
This PR adds the "Add New Task" Dialog.
Expected behaviour:
P0
T0
.then open the Edit Step dialog with the new Step selected.On the Edit Step dialog:pressing Esc or clicking the 'x' close button should close the dialogDesign: Tasks Page, with 0 Tasks
Design: "Add a new Task" dialog
Design: "Create Task" dialog (actually, it's the "Edit Step" dialog)
Code notes:
<dialog>
for modals; see Esc key isn't closing HTML dialog elements #6914 for additional details on some shenanigans that needed to be solved.Status
WIP