Skip to content

refactor!: move chips and overflow chip to light DOM - #4832

Merged
web-padawan merged 3 commits into
masterfrom
refactor/mscb-chips-light-dom
Oct 26, 2022
Merged

web-padawan merged 3 commits into
masterfrom
refactor/mscb-chips-light-dom

Conversation

@web-padawan

Copy link
Copy Markdown
Member

Description

Fixes #4300

  1. Moved vaadin-multi-select-combo-box-chip elements to light DOM using corresponding slots,
  2. Removed part from all chips, including overflow-one and overflow-two for the overflow chip,
  3. Changed the overflow chip to reflect label to attribute so that we can use [label="2"] instead,
  4. Added some CSS needed to override styles for slotted elements from vaadin-input-container.

Type of change

  • Breaking change

Before

mscb-before

After

mscb-after

@web-padawan
web-padawan force-pushed the refactor/mscb-chips-light-dom branch from 7dc11a9 to 06ba6c8 Compare October 25, 2022 11:52
Comment on lines +32 to +36
/* Override input-container styles */
::slotted([slot='chip']),
::slotted([slot='overflow']) {
padding: 0 0.5rem;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For Material theme, we only need to override padding:

::slotted(:not([slot$='fix'])) {
padding: 8px 0;
}

Comment on lines -26 to -28
[hidden] {
display: none !important;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This CSS is now moved to vaadin-multi-select-combo-box-chip.

Comment on lines +22 to +23
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

These styles are no longer inherited from the host element, so added them here.

@web-padawan
web-padawan force-pushed the refactor/mscb-chips-light-dom branch from 8b3f7f1 to 8967b67 Compare October 25, 2022 12:11
Comment on lines -964 to +953
const chips = Array.from(this._chips).slice(1);
const chips = this._chips;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No need to call .slice(1) anymore because this._chips no longer includes overflow chip.

comboBox.selectedItems = ['apple', 'banana', 'orange'];
await nextRender();
expect(overflow.label).to.equal(2);
expect(overflow.label).to.equal('2');

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The property was previously set as number, apparently because of data binding usage.

@web-padawan
web-padawan force-pushed the refactor/mscb-chips-light-dom branch from 272d4e1 to a49bacb Compare October 26, 2022 12:13
@sonarqubecloud

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@web-padawan
web-padawan removed the request for review from vursen October 26, 2022 13:23
@web-padawan
web-padawan merged commit 1cb8a1e into master Oct 26, 2022
@web-padawan
web-padawan deleted the refactor/mscb-chips-light-dom branch October 26, 2022 13:23
@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 24.0.0.

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.

Add ::part() selector support to chips in MultiSelectComboBox

3 participants