fix: ´IComboboxDropdown´ add mousedown to li element (refs SFKUI-8129) - #1643
fix: ´IComboboxDropdown´ add mousedown to li element (refs SFKUI-8129)#1643Stefan-ferm wants to merge 1 commit into
Conversation
Förhandsgranskning 🐛 🔍Dokumentation och exampel applikationer finns att förhandsgranska på: Exempel för testning:
Senast uppdaterad 2026-09-09 11:06 UTC i gh-pages. |
Artifact sizesArtifact sizes in this build (unchanged artifacts collapsed below).
6 unchanged artifacts
|
CHANGELOGBased on commits in this Pull Request this will create a patch release and the following entries will be added to the changelog: Bug Fixes
If this is not correct you can amend the commit message(s). Read more about the release process (swedish). |
| }, | ||
| onPreDropdownSelect(value: string): void { | ||
| this.clickedOnDropdown = true; | ||
| this.$emit("change", value); |
There was a problem hiding this comment.
Behöver man emitta eventet här också? Kommer det inte dubbelt då?
There was a problem hiding this comment.
Ja eftersom vi inte emittar change om clickOnDropdown är true, modellen kommer uppdateras men change kommer inte att emittas. Så det blir inte dubbelt
| cy.wrap(wrapper.vm).its("valtLand").should("equal", "Sverige"); | ||
| cy.wrap(wrapper.vm) | ||
| .its("changeEvent") | ||
| .should("deep.equal", ["Sverige", "Sverige"]); |
There was a problem hiding this comment.
Relaterat till min tidigare kommentar, här borde det väl bara dyka upp en gång?
There was a problem hiding this comment.
Jag tänkte skriva en kommentar just för den specen, det är cypress som triggar change en extra gång. Så blir det inte i browsern. Diskuterat med Mats om just det här testet vi kan ta upp det på kontoret. Cypress behandlar inte eventen på samma sätt som browsern. Om man vill att det ska bete sig på samma sätt måste man sätta upp testet och trigga event i den ordning de hade körts i browsern-
|
|
||
| cy.wrap(wrapper.vm).its("valtLand").should("equal", "Sverige"); | ||
| cy.wrap(wrapper.vm) | ||
| .its("changeEvent") |
There was a problem hiding this comment.
Kan vi testa update:modelValue eventet ocskå?
There was a problem hiding this comment.
ja inga problem, en egen behållare för det då tänker jag. Uppdaterat testet
| }); | ||
| }); | ||
|
|
||
| describe("ComboBox - Fix-validering", () => { |
There was a problem hiding this comment.
Ligger inte de andra testerna för combobox i en annan fil? Kanske flytta dessa tester till samma fil.
There was a problem hiding this comment.
ja det gör dem kanske, flyttar dem i så fall. Flyttade
| class="combobox__listbox__option" | ||
| :class="{ 'combobox__listbox__option--highlight': isOptionActive(item) }" | ||
| @click.stop.prevent="onOptionClick(item)" | ||
| @mousedown="onOptionSelect(item)" |
There was a problem hiding this comment.
Kan det hända att klicket inte fullföljs? att mouseup, click aldrig triggas. Kanske inte påverkar något.
There was a problem hiding this comment.
jo kanske ska testa typ trycka ner och inte släppa och sedan dra musen åt sidan men då sabbar man lite med vilje tänker jag. Den blir vald och boxen stängs vad som är rätt vet inte jag
There was a problem hiding this comment.
Spontant är det fel att något väljs då. Kikade på några andra designssystem, inget händer om man klickar och släpper utanför.
9a19271 to
5168f19
Compare
| // trigger v-model update when not handled by onValidity event | ||
| const element = this.$refs.input as HTMLInputElement; | ||
| if (!Object.hasOwn(element.dataset, "validation")) { | ||
| if (!Object.hasOwn(element.dataset, "validation") && !this.clickedOnDropdown) { |
There was a problem hiding this comment.
Detta är fallet när validering inte används. Har vi testat när validering är igång? allowList används i felrapporten.
5168f19 to
0660fd8
Compare
|
|
||
| cy.get("input").realClick(); | ||
| cy.get("input").realType("sv"); | ||
|
|
There was a problem hiding this comment.
Det här gör att det extra change eventet som triggades innan inte fullföljs längre :-)
a30c189 to
e59de44
Compare
| class="combobox__listbox__option" | ||
| :class="{ 'combobox__listbox__option--highlight': isOptionActive(item) }" | ||
| @click.stop.prevent="onOptionClick(item)" | ||
| @mousedown.stop.prevent |
There was a problem hiding this comment.
vi stoppar blur och change
d85c407 to
e4a2ac7
Compare
e4a2ac7 to
c2d9e9f
Compare
Innan fix:
man börjar skriva ett värde och väljer sedan önskat val från listan, det som händer då är att change triggas först och uppdaterar modellen med det påbörjade värdet. Om konsument gör ett anrop till backend från change så blir det fel. I nästa steg triggas select från klick och uppdatera modellen med det önskade värdet.