trimble-oss / modus-web-components

This library provides Modus components as web components - reusable, encapsulated UI elements that are framework agnostic (can be implemented in any site).
https://modus-web-components.trimble.com/
MIT License
32 stars 69 forks source link

Modus Button: Form events for button types `'submit'` and `'reset'` do not reach parent `form` HTML element #2538

Open ryan-henness-trimble opened 3 months ago

ryan-henness-trimble commented 3 months ago

Prerequisites

Describe the issue

When the Modus Button is used with the type 'submit' or 'reset', they should interact directly with their parent form HTML element. I'm running into an issue where the parent form's onSubmit and onReset functions do not fire when triggered by Modus Buttons:

<form onSubmit={handleSubmit} onReset={handleCancel}>
    <div>
        <ModusButton
            type="submit"
            disabled={hasFormErrors(formState)}
         >
             Submit
        </Button>
        <ModusButton color="tertiary" type="reset">
            Cancel
        </Button>
    </div>
</form>

I am assuming this is due to the elements being encapsulated under the Shadow DOM

Reduced test cases

No response

What operating system(s) are you seeing the problem on?

No response

What browser(s) are you seeing the problem on?

No response

What is the issue regarding ?

@trimble-oss/modus-web-components

What version of npm package are you using ?

No response

Priority

Medium

What product/project are you using Modus Components for ?

Modus Web Components

What is your team/division name ?

Trimble Viewpoint

Are you willing to contribute ?

Maybe

Are you using Modus Web Components in production ?

No response

github-actions[bot] commented 3 months ago

Hello @ryan-henness-trimble! Thanks for opening an issue. The Modus core team will get back to you soon (usually within 24-hours) and provide guidance on how to proceed. Contributors are welcome to participate in the discussion and provide their input on how to best solve the issue, and even submit a PR if they want to.

Please wait until the issue is ready to be worked on before submitting a PR, or you can reach out to the core team if it is time bound. For trivial things, or bugs that don't change the expected behaviors and UI, you can go ahead and make a PR.