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

Add Box, Flex, and Stack #771

Closed
alanbsmith opened this issue Jul 6, 2020 · 2 comments · Fixed by #1027
Closed

Add Box, Flex, and Stack #771

alanbsmith opened this issue Jul 6, 2020 · 2 comments · Fixed by #1027
Assignees
Labels
Milestone

Comments

@alanbsmith
Copy link
Member

alanbsmith commented Jul 6, 2020

🚀 Feature Proposal

We should add spacing / layout components to canvas-kit. We can start with the following:

  • Box - a low-level primitive component
  • Flex - a low-level layout component for building layouts with Flexbox
  • Stack / HStack / VStack - higher-level abstractions for building layouts with Flexbox

Motivation

This is an important part of developing a component hierarchy that will enable us to make canvas-kit more flexible and extensible.

Other links:

Example

Here's a proof of concept for Box, Flex, and Stack

@mathalete
Copy link

mathalete commented Jul 6, 2020

Hi @alanbsmith I get the truncation is an example - but note that the overflow:ellipsis pattern that uses the title attribute isn't accessible to touch, dictation or keyboard users.

I do think a primitive for headings would be helpful as reusable components will appear in different contexts, at different levels in the document heading structure. It should therefore be allowed to change the heading level of the component’s main heading via a level primitive / prop.

The aria-level property can be used to change the perceived level for AT (assistive tech).

Note that aria-level only works on heading elements (<h1><h6>) or elements with role="heading".

It is recommended the default prop value is 2, since most components will start at that level.

This would obviously be used as a workaround when heading levels are proving challenging to refactor.

<!-- component code -->
<h2 aria-level="{this.props.level}"></h2>

<!-- instance -->
<MyComponent level="3" />

<!-- how a screen reader perceives the MyComponent heading -->
<h3>Component name / main component heading text</h3>

@alanbsmith
Copy link
Member Author

Thanks for the feedback, @mathalete! I made this issue as a quick note, but we should talk about it more. 😀 There are a lot of situations where truncation is being used (or will potentially be used), and I’d like to have a11y guarantees and guidelines all in one spot. That’ll make it easier for everyone to get it right on the first pass.

@jpante jpante added this to Open in Backlog via automation Jul 6, 2020
@jpante jpante moved this from Open to Notes/Questions in Backlog Jan 4, 2021
@jpante jpante added this to the 5.0.0 milestone Jan 19, 2021
@jpante jpante added the 5.x label Jan 19, 2021
@jpante jpante moved this from Notes/Questions to Up Next in Backlog Jan 19, 2021
@jpante jpante changed the title [WIP] Add low-level component primitives Add low-level component primitives Feb 9, 2021
@jpante jpante added this to To-do (This Sprint) in Current Sprint (7/20 - 8/9) via automation Feb 9, 2021
@jpante jpante removed this from Up Next in Backlog Feb 9, 2021
@alanbsmith alanbsmith moved this from To-do (This Sprint) to In Progress in Current Sprint (7/20 - 8/9) Mar 1, 2021
@jpante jpante moved this from In Progress to To-do (This Sprint) in Current Sprint (7/20 - 8/9) Mar 23, 2021
@jpante jpante moved this from To-do (This Sprint) to In Progress in Current Sprint (7/20 - 8/9) Apr 13, 2021
@jpante jpante linked a pull request May 4, 2021 that will close this issue
9 tasks
@alanbsmith alanbsmith changed the title Add low-level component primitives Add Box, Flex, and Stack May 7, 2021
@jpante jpante moved this from In Progress to Needs Review in Current Sprint (7/20 - 8/9) May 17, 2021
@jpante jpante added the ready for review Code is ready for review label May 17, 2021
@jpante jpante moved this from Needs Review to Done in Current Sprint (7/20 - 8/9) May 26, 2021
@alanbsmith alanbsmith added approved Code has been reviewed and approved (ship it) and removed ready for review Code is ready for review labels May 27, 2021
@alanbsmith alanbsmith removed approved Code has been reviewed and approved (ship it) sprint commitment labels Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants