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

assorted relationship field fixes #5855

Merged
merged 8 commits into from
Jun 8, 2021
Merged

Conversation

gwyneplaine
Copy link
Contributor

@gwyneplaine gwyneplaine commented Jun 3, 2021

  • Replaced div FieldContainer with fieldset element
  • Added flex styling to inline-connect such that the select has more space to sit.
    • before Screen Shot 2021-06-03 at 4 03 10 pm
    • after Screen Shot 2021-06-03 at 4 02 58 pm
  • Card view is now an unordered list for better SR experience (and semantics)
  • Added VisuallyHidden headings to mark the beginning of each new list item.
  • Added role="status" to CardContainer to help with announcing dom changes when a card exits and enters edit mode.

New screen reader experience below:

Uploading relationship-field-updates.mov…

@changeset-bot
Copy link

changeset-bot bot commented Jun 3, 2021

🦋 Changeset detected

Latest commit: 8913c74

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@keystone-next/fields Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jun 3, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/keystonejs/keystone-next-docs/3RERvtcXWdpiqVyHD3hFGCgvaqPm
✅ Preview: https://keystone-next-docs-git-a11y-relationship-field-label-keystonejs.vercel.app

@vercel vercel bot temporarily deployed to Preview June 3, 2021 06:54 Inactive
@gwyneplaine gwyneplaine force-pushed the a11y/relationship-field-label branch from 826a003 to d5c267c Compare June 3, 2021 06:55
@vercel vercel bot temporarily deployed to Preview June 3, 2021 06:57 Inactive
@vercel vercel bot temporarily deployed to Preview June 4, 2021 05:38 Inactive
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 4, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@gwyneplaine gwyneplaine force-pushed the a11y/relationship-field-label branch from 5b7f0db to 6b8c5d2 Compare June 4, 2021 05:43
@vercel vercel bot temporarily deployed to Preview June 4, 2021 05:43 Inactive
marginY="medium"
across
css={{
width: '100%',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same fix as in the images and file field.
We don't have a good way to individually alter the flex styles of children since each child is programatically wrapped in an element, so we have to do it here.

@@ -113,7 +113,7 @@ export const Field = ({

if (value.kind === 'cards-view') {
return (
<Stack as="fieldset" gap="medium">
<FieldContainer as="fieldset">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the legend element expects to have a fieldset element as its immediate parent.
the Stack component negates this via its inherent behaviour (wrapping each child in a pre-styled element)

@@ -143,7 +143,7 @@ export const Field = ({
}

return (
<FieldContainer>
<FieldContainer as="fieldset">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

see above

}
itemForField[graphqlField] = fieldGetter.data;
}
<Stack
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We only want to wrap the list items in a ul, the actions for creating a new item / inline connection to an existing item should sit outside of this list.

@vercel vercel bot temporarily deployed to Preview June 6, 2021 23:56 Inactive
@vercel vercel bot temporarily deployed to Preview June 7, 2021 04:30 Inactive
const itemGetter = items[id];
const isEditMode = !!(onChange !== undefined) && value.itemsBeingEdited.has(id);
return (
<CardContainer role="status" mode={isEditMode ? 'edit' : 'view'}>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

persistent card container now so we can append a role status, and announce when a card enters edit mode and vice versa.

@gwyneplaine gwyneplaine requested a review from a team June 8, 2021 00:05
@vercel vercel bot temporarily deployed to Preview June 8, 2021 00:06 Inactive
@vercel vercel bot temporarily deployed to Preview June 8, 2021 00:08 Inactive
@gwyneplaine gwyneplaine enabled auto-merge (squash) June 8, 2021 00:21
@gwyneplaine gwyneplaine merged commit e4c19f8 into master Jun 8, 2021
@gwyneplaine gwyneplaine deleted the a11y/relationship-field-label branch June 8, 2021 00:42
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.

2 participants