Skip to content

fix: searchbox cta warnings in form#1368

Merged
Ninfa-Jeon merged 2 commits into
canonical:mainfrom
Ninfa-Jeon:multi-select-improvements-2
May 4, 2026
Merged

fix: searchbox cta warnings in form#1368
Ninfa-Jeon merged 2 commits into
canonical:mainfrom
Ninfa-Jeon:multi-select-improvements-2

Conversation

@Ninfa-Jeon
Copy link
Copy Markdown
Contributor

@Ninfa-Jeon Ninfa-Jeon commented May 1, 2026

Done

The SearchBox component and consequently the MultiSelect component were throwing warnings when rendered within a formik form. This was due to the fact that the search button within SearchBox was being rendered without an explicit type="submit" prop.

  • Resolved the above by setting type="submit" by default on SearchBox search button
  • Exposed a searchButtonType prop in case the button type needs to change
  • Exposed dropdownClassName, inputClassName and footerClassName props to fine tune MultiSelect as needed. This is because the dropdown is being rendered within a portal, making global override the only other solution.

QA

Pinging @canonical/react-library-maintainers for a review.

Storybook

To see rendered examples of all react-components, run:

yarn start

QA in your project

from react-components run:

yarn build
npm pack

Install the resulting tarball in your project with:

yarn add <path-to-tarball>

QA steps

  • View the storybook story to verify that the custom classname props work
  • Change the FormikField to render multiselect and try clicking the search button on it. The following error should not appear in console:
Warning: You submitted a Formik form using a button with an unspecified type attribute. Most browsers default button elements to type="submit". If this is not a submit button, please add type="button"

Copy link
Copy Markdown
Contributor

@huwshimi huwshimi left a comment

Choose a reason for hiding this comment

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

A few small changes here.

Comment thread src/components/MultiSelect/MultiSelect.tsx Outdated
Comment thread src/components/SearchBox/SearchBox.tsx Outdated
Comment thread src/components/MultiSelect/MultiSelect.stories.tsx Outdated
@Ninfa-Jeon Ninfa-Jeon force-pushed the multi-select-improvements-2 branch from 7af3eeb to 0ead970 Compare May 4, 2026 05:16
Copy link
Copy Markdown
Contributor

@huwshimi huwshimi left a comment

Choose a reason for hiding this comment

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

Thanks for the updates!

@Ninfa-Jeon Ninfa-Jeon merged commit 2cd551d into canonical:main May 4, 2026
10 checks passed
@Ninfa-Jeon Ninfa-Jeon deleted the multi-select-improvements-2 branch May 4, 2026 05:28
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

🎉 This PR is included in version 4.5.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants