Skip to content

Select, SelectMultiple -- Add extend to listbox #7496

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

Merged
merged 2 commits into from
Jan 30, 2025
Merged

Conversation

taysea
Copy link
Collaborator

@taysea taysea commented Jan 30, 2025

What does this PR do?

This PR adds an extend to the theme for the "listbox" container directly surrounding the options. Open to naming suggestions, but things like "option.container" etc were already taken and apply to different things. "Listbox" is because this is the container with role="listbox".

Had to pass through selectMultiple as a prop on OptionsContainer so that the extend could differentiate between desired styling for Select vs SelectMultiple

Where should the reviewer start?

src/js/components/Select/StyledSelect.js

What testing has been done on this PR?

Locally. Also added jest tests.

How should this be manually tested?

theme: {
   select: {
      listbox: {
          extend: `padding: 24px;`,
      },
   },
  selectMultiple: {
      listbox: {
          extend: `padding: 12px;`,
      },
   },
}

Do Jest tests follow these best practices?

  • screen is used for querying.
  • The correct query is used. (Refer to this list of queries)
  • asFragment() is used for snapshot testing.

Any background context you want to provide?

What are the relevant issues?

Screenshots (if appropriate)

Do the grommet docs need to be updated?

Yes.

Should this PR be mentioned in the release notes?

Yes.

Is this change backwards compatible or is it a breaking change?

Backwards compatible.

@taysea taysea requested review from jcfilben and halocline January 30, 2025 00:16
Copy link
Collaborator

@jcfilben jcfilben left a comment

Choose a reason for hiding this comment

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

Looks good!

@taysea taysea requested a review from britt6612 January 30, 2025 16:26
expectPortal('test-listbox__drop').toMatchSnapshot();
const listbox = getByRole('listbox');
const styles = window.getComputedStyle(listbox);
expect(styles.padding).toBe('24px');
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice 🙌

@britt6612
Copy link
Collaborator

LGTM!

Just one small comment! Also listBox makes sense to me I think the naming works

Co-authored-by: Brittany <42451602+britt6612@users.noreply.github.com>
@jcfilben jcfilben merged commit 60c38df into master Jan 30, 2025
16 checks passed
@jcfilben jcfilben deleted the select-listbox branch January 30, 2025 16:56
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.

3 participants