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

chore(grid): refactor storybook #427

Merged
merged 5 commits into from
Mar 4, 2022
Merged

chore(grid): refactor storybook #427

merged 5 commits into from
Mar 4, 2022

Conversation

jzempel
Copy link
Member

@jzempel jzempel commented Mar 3, 2022

Description

Following #420, update storybook for the grid package.

Checklist

  • 🌐 Storybook demo is up-to-date (yarn start)
  • β™Ώ analyzed via axe and evaluated using VoiceOver
  • πŸ’‚β€β™‚οΈ includes new unit tests
  • πŸ“ tested in Chrome, Firefox, Safari, Edge, and IE11

@jzempel jzempel requested a review from a team as a code owner March 3, 2022 00:18
Comment on lines +26 to +30
const {
role,
'aria-selected': selected, // the gridcell itself is not selectable in this implementation
...props
} = getGridCellProps({ rowIdx, colIdx });
Copy link
Member Author

Choose a reason for hiding this comment

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

This prop extraction and subsequent usage of the current grid's selection concept below is a key demo differentiation that corrects previous invalid ARIA and points the way for how we'll address an updated ColorSwatch in react-components by refactoring to use radio buttons (or checkboxes, depending on design) for selection.

@coveralls
Copy link

coveralls commented Mar 3, 2022

Coverage Status

Coverage remained the same at 95.969% when pulling c5d1ea9 on jzempel/demo-grid into d82a9ef on main.

Comment on lines +28 to +30
"jsx-a11y/label-has-associated-control": "off",
"react/button-has-type": "off",
"react/jsx-key": "off"
Copy link
Contributor

Choose a reason for hiding this comment

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

Any particular reasons why these rules are turned off?

Copy link
Member Author

Choose a reason for hiding this comment

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

They weren't really turned off, per se. This limits their scope to just spec tests. Previously they were applied to both stories and spec tests.

size: number;
}

export const GridStory: Story<IArgs> = ({ as, ...props }) => {
Copy link
Contributor

@hzhu hzhu Mar 3, 2022

Choose a reason for hiding this comment

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

I think the previous stories passed a idPrefix to the underlying hook. Should these stories pass the idPrefix too?

Screen Shot 2022-03-03 at 1 29 08 PM

Copy link
Member Author

Choose a reason for hiding this comment

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

Stories should not internally mask gaps in the underlying component code. In this case, the idPrefix is an optional prop that can be set via storybook controls. The undefined string is an indication that either a) the prop should be mandatory or b) there should be a default fallback for ID generation (preferable and similar to other container code). This should probably be addressed as a follow-on.

@jzempel jzempel merged commit b1e8bef into main Mar 4, 2022
@jzempel jzempel deleted the jzempel/demo-grid branch March 4, 2022 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants