Skip to content

Fix SelectMultiple drop scrolling bug #6735

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
Apr 7, 2023

Conversation

jcfilben
Copy link
Collaborator

@jcfilben jcfilben commented Apr 5, 2023

What does this PR do?

Fixes an issue where the SelectMultiple drop would scroll back to the top after selecting an option.

Where should the reviewer start?

What testing has been done on this PR?

Tested with the following story:

import React from 'react';

import { Box, SelectMultiple } from 'grommet';

const dummyOptions = Array(100)
  .fill()
  .map((_, i) => `option ${i}`)
  .sort((a, b) =>
    a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' }),
  );

export const Test = () => (
  <Box gap="large" fill align="center" justify="start" pad="large">
    <SelectMultiple
      options={dummyOptions}
      showSelectedInline
      placeholder="select an option..."
    />
  </Box>
);

Test.args = {
  full: true,
};

export default {
  title: 'Input/SelectMultiple/Test',
};

How should this be manually tested?

Do Jest tests follow these best practices?

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

Any background context you want to provide?

What are the relevant issues?

Closes #6709

Screenshots (if appropriate)

Do the grommet docs need to be updated?

No

Should this PR be mentioned in the release notes?

Yes

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

Backwards compatible

@jcfilben jcfilben requested review from taysea and halocline April 5, 2023 20:28
Copy link
Collaborator

@taysea taysea left a comment

Choose a reason for hiding this comment

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

This fix worked when I tested locally nice job.

@jcfilben jcfilben merged commit 656f869 into grommet:master Apr 7, 2023
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.

SelectMultiple loses scroll position on select, when inside FormField
3 participants