siemens / ix

Siemens Industrial Experience is a design system for designers and developers, to consistently create the perfect digital experience for industrial software products.
https://ix.siemens.io/
MIT License
174 stars 62 forks source link

Clicking a entry in a select, also triggers a click in the backdrop #1229

Open Stefei opened 2 months ago

Stefei commented 2 months ago

Prerequisites

What happened?

Clicking a entry in a select, will also trigger a click in the backdrop. This is a problem for us, because we use a modal that closes if the user clicks outside of the modal bounds.

What type of frontend framework are you seeing the problem on?

Angular, JavaScript

Which version of iX do you use?

v2.1.0

Code to produce this issue.

import { Component } from '@angular/core';

@Component({
  selector: 'app-example',
  template: `
    <div style="background-color:#ffffff; height: 1000px" onclick="console.log('backdrop clicked')">
    <ix-select [value]="value">
      <ix-select-item label="Item 1" value="1"></ix-select-item>
      <ix-select-item label="Item 2" value="2"></ix-select-item>
      <ix-select-item label="Item 3" value="3"></ix-select-item>
      <ix-select-item label="Item 4" value="4"></ix-select-item>
    </ix-select>
  `,
})
export default class Select {
  value = '1';
}
matthiashader commented 1 month ago

Hello @Stefei - thanks for your insight! Actually the default webcomponents behave this way, i have provided a little stackblitz example below, if you really want to prohibit the backdrop click you can still manually configure it with stopPropagation. https://stackblitz.com/edit/ob7nug-71atcf?file=src%2Fapp%2Fselect.ts If you have any further questions, let me know :)