Skip to content

SelectPanel2: Add back button - #4288

Merged
siddharthkp merged 13 commits into
mainfrom
drafts-selectpanel-back-button
Mar 7, 2024
Merged

SelectPanel2: Add back button#4288
siddharthkp merged 13 commits into
mainfrom
drafts-selectpanel-back-button

Conversation

@siddharthkp

@siddharthkpsiddharthkp commented Feb 20, 2024

Copy link
Copy Markdown
Member

@changeset-bot

changeset-botBot commented Feb 20, 2024

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 065f107

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

This PR includes changesets to release 1 package
NameType
@primer/reactMinor

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

@siddharthkpsiddharthkp self-assigned this Feb 20, 2024
@github-actions

github-actionsBot commented Feb 20, 2024

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
packages/react/dist/browser.esm.js113.71 KB (+0.02% 🔺)
packages/react/dist/browser.umd.js114.38 KB (+0.01% 🔺)

@joshblack

Copy link
Copy Markdown
Member

@siddharthkp for reviewing, should I be looking at the semantics of the nested selection story or should I be just looking at the back button behavior? Seeing the initial listbox was surprising so just wanted to double-check what I should be looking at in this PR 👀

@siddharthkp

Copy link
Copy Markdown
MemberAuthor

@siddharthkp for reviewing, should I be looking at the semantics of the nested selection story or should I be just looking at the back button behavior?

Both are welcome!

Seeing the initial listbox was surprising

I can go either way on this 🤔

Repositories from the first panel still could be treated as "selected", with PRs inside them being displayed outside the panel.

Orrr we could treat the first panel/layer simply as filtering buttons that lead to the actual "options" that can be selected.

What do you think?

@joshblackjoshblack left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Going through this, something I'm not sure about is the listbox being used for nested selection in this way. Something that is disorienting is that you make a selection in a listbox and then shift to a text input and you don't necessarily know why depending on the screen reader. This kind of relationship almost feels more like checkbox groups or a tree.

When going through it with voiceover, I noticed that sometimes the virtual cursor and the focused element got out of sync in selection 🤔 Not sure why but this may be unrelated to this PR. It also seems like hitting escape out of the second dialog will not restore focus to the button and will make it so that you cannot open the dialog again.

@siddharthkp

Copy link
Copy Markdown
MemberAuthor

Going through this, something I'm not sure about is the listbox being used for nested selection in this way. Something that is disorienting is that you make a selection in a listbox and then shift to a text input and you don't necessarily know why depending on the screen reader.

Very valid!

I changed it to role=list for now and added a warning about accessibility on the story. Let's focus on shipping the back button and then we can get some guidance on the accessible markup for this story!

@joshblackjoshblack left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving for onBack support 👍

})

const SelectPanelHeader: React.FC<React.PropsWithChildren> = ({children, ...props}) => {
const SelectPanelHeader: React.FC<React.PropsWithChildren & {onBack?: () => void}> = ({children, onBack, ...props}) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Another syntax if it's helpful, React.PropsWithChildren is generic over input props

Suggested change
constSelectPanelHeader: React.FC<React.PropsWithChildren&{onBack?: ()=>void}>=({children, onBack, ...props})=>{
constSelectPanelHeader: React.FC<React.PropsWithChildren<{onBack?: ()=>void}>>=({children, onBack, ...props})=>{

@siddharthkp
siddharthkp requested a review from a team as a code ownerMarch 7, 2024 10:25
@github-actions
github-actionsBottemporarily deployed to storybook-preview-4288 March 7, 2024 10:29 Inactive
@siddharthkp
siddharthkp added this pull request to the merge queueMar 7, 2024
Merged via the queue into main with commit 200fb18Mar 7, 2024
@siddharthkp
siddharthkp deleted the drafts-selectpanel-back-button branch March 7, 2024 10:46
@primerprimerBot mentioned this pull request Mar 6, 2024
@siddharthkpsiddharthkp changed the title experimental/SelectPanel2: Add back buttonSelectPanel2: Add back buttonMar 19, 2024
lukasoppermann pushed a commit that referenced this pull request Apr 16, 2024
* add back button
* add nested panel example
* fix nested panel focus
* implement save and cancel on second panel
* add onCancel for first panel
* Create fair-sloths-kick.md
* add preview for selection
* show dividers
* hide selection in story
* update snapshots
* make the first ActionList role=list
* add warning to story
Sign up for freeto 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

@siddharthkp@joshblack