Skip to content
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

fix(core/modal): fixed closing modal issue when press space or enter #1080

Merged
merged 2 commits into from
Feb 20, 2024

Conversation

ridvandmrc
Copy link
Contributor

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (yarn build) was run locally and any changes were pushed
  • Unit tests (yarn test) were run locally and passed
  • Visual Regression Tests (yarn visual-regression) were run locally and passed
  • Linting (npm lint) was run locally and passed

Pull request type

Please check the type of change your PR introduces:

  • Bug fix
  • Feature
  • Refactoring (no functional changes, no API changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

The modal is closing when focus some input element and press 'space'

GitHub Issue Number: #1077

What is the new behavior?

The reason was that clickoutSide is triggered when press the space,
I checked that if the event is pointer event (click or touch) or not

Does this introduce a breaking change?

  • Yes
  • No

Testing

Other information

@danielleroux
Copy link
Collaborator

How do you think about using the check if the event target is not the dialog element itself then closing the modal?

  private onModalClick(event: MouseEvent) {
    if (event.target !== this.dialog) {
      return;
    }

@ridvandmrc ridvandmrc closed this Feb 20, 2024
@ridvandmrc ridvandmrc reopened this Feb 20, 2024
@ridvandmrc
Copy link
Contributor Author

@danielleroux , It worked and clear already fixed

@danielleroux
Copy link
Collaborator

Looks good. I will add some tests after merge.

@danielleroux danielleroux changed the title fix(modal-keyboard): fixed closing modal issue when press space or enter fix(core/modal): fixed closing modal issue when press space or enter Feb 20, 2024
@danielleroux danielleroux added the pull request affects patch version The pull request affects only patch version label Feb 20, 2024
@danielleroux danielleroux merged commit 214012f into siemens:main Feb 20, 2024
12 checks passed
@danielleroux danielleroux added this to the 2.1.1 milestone Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pull request affects patch version The pull request affects only patch version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants