Skip to content

Commit

Permalink
Merge branch 'main' into renovate/main-playwright
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/elements/select/select.spec.ts
#	src/elements/select/select.ts
  • Loading branch information
jeripeierSBB committed Dec 11, 2024
2 parents 103c4e4 + 7393f00 commit c42f79f
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 49 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ Lyne Design Tokens and Lyne Components are available for developers and designer

## 🔗 Packages

| Package | Description |
| ---------------------------------- | --------------------------------------------------------------------------- |
| `@lyne-esta/elements` | Web components built on top of the Lyne Design System |
| `@lyne-esta/elements-experimental` | Web components that do not yet align with our architecture or testing goals |
| `@lyne-esta/react` | React wrappers for `@lyne-esta/elements` |
| `@lyne-esta/react-experimental` | React wrappers for `@lyne-esta/elements-experimental` |
| Package | Description |
| -------------------------------------- | --------------------------------------------------------------------------- |
| `@sbb-esta/lyne-elements` | Web components built on top of the Lyne Design System |
| `@sbb-esta/lyne-elements-experimental` | Web components that do not yet align with our architecture or testing goals |
| `@sbb-esta/lyne-react` | React wrappers for `@sbb-esta/lyne-elements` |
| `@sbb-esta/lyne-react-experimental` | React wrappers for `@sbb-esta/lyne-elements-experimental` |

- [NPM Packages](https://www.npmjs.com/search?q=%40sbb-esta%2Flyne-)

Expand Down
2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ You can file new issues by providing the above information [here](https://github

### <a name="submit-pr"></a> Submitting a Pull Request (PR)

- Search [GitHub](https://github.com/angular/components/pulls) for an open or closed PR
- Search [GitHub](https://github.com/sbb-design-systems/lyne-components/pulls) for an open or closed PR
that relates to your submission. You don't want to duplicate effort.
- Make your changes in a new git branch:

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"devDependencies": {
"@commitlint/cli": "19.6.0",
"@commitlint/config-conventional": "19.6.0",
"@custom-elements-manifest/analyzer": "0.10.3",
"@custom-elements-manifest/analyzer": "0.10.4",
"@custom-elements-manifest/to-markdown": "0.1.0",
"@eslint/eslintrc": "3.2.0",
"@eslint/js": "9.16.0",
Expand All @@ -100,7 +100,7 @@
"@types/glob": "8.1.0",
"@types/mocha": "10.0.10",
"@types/node": "20.17.9",
"@types/react": "18.3.14",
"@types/react": "18.3.16",
"@typescript-eslint/eslint-plugin": "8.18.0",
"@typescript-eslint/parser": "8.18.0",
"@web/test-runner": "0.19.0",
Expand All @@ -122,7 +122,7 @@
"glob": "11.0.0",
"globals": "15.13.0",
"husky": "9.1.7",
"lint-staged": "15.2.10",
"lint-staged": "15.2.11",
"lit-analyzer": "2.0.3",
"madge": "8.0.0",
"npm-run-all2": "7.0.1",
Expand Down
7 changes: 5 additions & 2 deletions src/elements/form-field/form-field/form-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class SbbFormFieldElement extends SbbNegativeMixin(SbbHydrationMixin(LitElement)
'sbb-slider',
];
// List of elements that should not focus input on click
private readonly _excludedFocusElements = ['button', 'sbb-popover'];
private readonly _excludedFocusElements = ['button', 'sbb-popover', 'sbb-option'];

private readonly _floatingLabelSupportedInputElements = [
'input',
Expand Down Expand Up @@ -168,7 +168,10 @@ class SbbFormFieldElement extends SbbNegativeMixin(SbbHydrationMixin(LitElement)
return;
}

if (this._input?.localName === 'sbb-select') {
if (
this._input?.localName === 'sbb-select' &&
(event.target as HTMLElement).localName !== 'sbb-select'
) {
this._input.click();
this._input.focus();
} else if ((event.target as Element).localName !== 'label') {
Expand Down
13 changes: 11 additions & 2 deletions src/elements/select/select.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assert, aTimeout, expect } from '@open-wc/testing';
import { sendKeys } from '@web/test-runner-commands';
import { sendKeys, sendMouse } from '@web/test-runner-commands';
import { html } from 'lit/static-html.js';

import { fixture, tabKey } from '../core/testing/private.js';
Expand Down Expand Up @@ -783,7 +783,15 @@ describe(`sbb-select`, () => {
const didOpen = new EventSpy(SbbSelectElement.events.didOpen, element);
const didClose = new EventSpy(SbbSelectElement.events.didClose, element);

element.dispatchEvent(new CustomEvent('click'));
const positionRect = element.getBoundingClientRect();
await sendMouse({
type: 'click',
position: [
Math.round(positionRect.x + window.scrollX + positionRect.width / 2),
Math.round(positionRect.y + window.scrollY + positionRect.height / 2),
],
});

await waitForLitRender(element);
await didOpen.calledOnce();

Expand All @@ -793,6 +801,7 @@ describe(`sbb-select`, () => {
await waitForLitRender(element);
await didClose.calledOnce();

expect(didOpen.count).to.be.equal(1);
expect(comboBoxElement).to.have.attribute('aria-expanded', 'false');
expect(element.value).to.be.equal('1');
});
Expand Down
4 changes: 1 addition & 3 deletions src/elements/select/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,14 +355,12 @@ class SbbSelectElement extends SbbUpdateSchedulerMixin(
this.addEventListener(
'click',
(e: MouseEvent) => {
// Avoid bubbling click to form field, where it would trigger this click again
e.stopPropagation();

const target = e.target as SbbSelectElement | SbbOptionElement;
if (target.localName === 'sbb-option') {
// Option click
if (!this.multiple && !target.disabled) {
this.close();
this.focus();
}
} else {
this._toggleOpening();
Expand Down
52 changes: 20 additions & 32 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,10 @@
resolved "https://registry.yarnpkg.com/@csstools/selector-specificity/-/selector-specificity-5.0.0.tgz#037817b574262134cabd68fc4ec1a454f168407b"
integrity sha512-PCqQV3c4CoVm3kdPhyeZ07VmBRdH2EpMFA/pd9OASpOEC3aXNGoqPDAZ80D0cLpMBxnmk0+yNhGsEx31hq7Gtw==

"@custom-elements-manifest/[email protected].3":
version "0.10.3"
resolved "https://registry.yarnpkg.com/@custom-elements-manifest/analyzer/-/analyzer-0.10.3.tgz#3b12957514475b24672ed08f48e007c7e5f018ea"
integrity sha512-e2Ax59vK9sNedmDlPqZS11L54iAlKSjOJuv5etpTy5SygLBW3GcUtocHZm8wO013L0griTPpgWB0tuV7/JXy5A==
"@custom-elements-manifest/[email protected].4":
version "0.10.4"
resolved "https://registry.yarnpkg.com/@custom-elements-manifest/analyzer/-/analyzer-0.10.4.tgz#7bd063cd1249a75b13d5bcc6ed4302dd72dd1f88"
integrity sha512-hse8o20Jd82BwWank29/J9OC4PmSTwUoEmll3LEjDF3WLY/Lc8g3TUYSib/3GARCS8Q5myT2RPqEWfRa+6bkIg==
dependencies:
"@custom-elements-manifest/find-dependencies" "^0.0.5"
"@github/catalyst" "^1.6.0"
Expand Down Expand Up @@ -1834,10 +1834,10 @@
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.7.tgz#50ae4353eaaddc04044279812f52c8c65857dbcb"
integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==

"@types/[email protected].14":
version "18.3.14"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.3.14.tgz#7ce43bbca0e15e1c4f67ad33ea3f83d75aa6756b"
integrity sha512-NzahNKvjNhVjuPBQ+2G7WlxstQ+47kXZNHlUvFakDViuIEfGY926GqhMueQFZ7woG+sPiQKlF36XfrIUVSUfFg==
"@types/[email protected].16":
version "18.3.16"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.3.16.tgz#5326789125fac98b718d586ad157442ceb44ff28"
integrity sha512-oh8AMIC4Y2ciKufU8hnKgs+ufgbA/dhPTACaZPM86AbwX9QwnFtSoPWEeRUj8fge+v6kFt78BXcDhAU1SrrAsw==
dependencies:
"@types/prop-types" "*"
csstype "^3.0.2"
Expand Down Expand Up @@ -3514,7 +3514,7 @@ [email protected], debounce@^1.2.0:
resolved "https://registry.yarnpkg.com/debounce/-/debounce-1.2.1.tgz#38881d8f4166a5c5848020c11827b834bcb3e0a5"
integrity sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==

debug@4, debug@^4.0.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@^4.3.6, debug@^4.3.7:
debug@4, debug@^4.0.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@^4.3.6, debug@^4.3.7, debug@~4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.0.tgz#2b3f2aea2ffeb776477460267377dc8710faba8a"
integrity sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==
Expand All @@ -3535,13 +3535,6 @@ debug@^3.1.0, debug@^3.2.7:
dependencies:
ms "^2.1.1"

debug@~4.3.6:
version "4.3.7"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.7.tgz#87945b4151a011d76d95a198d7111c865c360a52"
integrity sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==
dependencies:
ms "^2.1.3"

decode-named-character-reference@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz#daabac9690874c394c81e4162a0304b35d824f0e"
Expand Down Expand Up @@ -5653,7 +5646,7 @@ lighthouse-logger@^1.0.0:
debug "^2.6.9"
marky "^1.2.2"

lilconfig@~3.1.2:
lilconfig@~3.1.3:
version "3.1.3"
resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-3.1.3.tgz#a1bcfd6257f9585bf5ae14ceeebb7b559025e4c4"
integrity sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==
Expand All @@ -5663,23 +5656,23 @@ lines-and-columns@^1.1.6:
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==

[email protected].10:
version "15.2.10"
resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-15.2.10.tgz#92ac222f802ba911897dcf23671da5bb80643cd2"
integrity sha512-5dY5t743e1byO19P9I4b3x8HJwalIznL5E1FWYnU6OWw33KxNBSLAc6Cy7F2PsFEO8FKnLwjwm5hx7aMF0jzZg==
[email protected].11:
version "15.2.11"
resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-15.2.11.tgz#e88440982f4a4c1d55a9a7a839259ec3806bd81b"
integrity sha512-Ev6ivCTYRTGs9ychvpVw35m/bcNDuBN+mnTeObCL5h+boS5WzBEC6LHI4I9F/++sZm1m+J2LEiy0gxL/R9TBqQ==
dependencies:
chalk "~5.3.0"
commander "~12.1.0"
debug "~4.3.6"
debug "~4.4.0"
execa "~8.0.1"
lilconfig "~3.1.2"
listr2 "~8.2.4"
lilconfig "~3.1.3"
listr2 "~8.2.5"
micromatch "~4.0.8"
pidtree "~0.6.0"
string-argv "~0.3.2"
yaml "~2.5.0"
yaml "~2.6.1"

listr2@~8.2.4:
listr2@~8.2.5:
version "8.2.5"
resolved "https://registry.yarnpkg.com/listr2/-/listr2-8.2.5.tgz#5c9db996e1afeb05db0448196d3d5f64fec2593d"
integrity sha512-iyAZCeyD+c1gPyE9qpFu8af0Y+MRtmKOncdGoA2S5EY8iFq99dmmvkNnHiWo+pj0s7yH7l3KPIgee77tKpXPWQ==
Expand Down Expand Up @@ -8972,16 +8965,11 @@ yaml-eslint-parser@^1.2.1:
lodash "^4.17.21"
yaml "^2.0.0"

yaml@^2.0.0:
yaml@^2.0.0, yaml@~2.6.1:
version "2.6.1"
resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.6.1.tgz#42f2b1ba89203f374609572d5349fb8686500773"
integrity sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg==

yaml@~2.5.0:
version "2.5.1"
resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.5.1.tgz#c9772aacf62cb7494a95b0c4f1fb065b563db130"
integrity sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==

yargs-parser@^21.1.1:
version "21.1.1"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35"
Expand Down

0 comments on commit c42f79f

Please sign in to comment.