From 9b9485dbaa9945afb91df0d7040eac33bbe77a77 Mon Sep 17 00:00:00 2001 From: gerjanvangeest Date: Mon, 11 Sep 2023 14:24:39 +0200 Subject: [PATCH] fix(calendar): focusCentralDate function should only use buttons inside the dates table (#2072) --- .changeset/khaki-wasps-worry.md | 5 +++++ packages/ui/components/calendar/src/LionCalendar.js | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/khaki-wasps-worry.md diff --git a/.changeset/khaki-wasps-worry.md b/.changeset/khaki-wasps-worry.md new file mode 100644 index 000000000..acac8d0ca --- /dev/null +++ b/.changeset/khaki-wasps-worry.md @@ -0,0 +1,5 @@ +--- +'@lion/ui': patch +--- + +[calendar] focusCentralDate function should only use buttons inside the dates table diff --git a/packages/ui/components/calendar/src/LionCalendar.js b/packages/ui/components/calendar/src/LionCalendar.js index 48a7bfb63..ee7057769 100644 --- a/packages/ui/components/calendar/src/LionCalendar.js +++ b/packages/ui/components/calendar/src/LionCalendar.js @@ -250,7 +250,10 @@ export class LionCalendar extends LocalizeMixin(LitElement) { } focusCentralDate() { - const button = /** @type {HTMLElement} */ (this.shadowRoot?.querySelector('[tabindex="0"]')); + const datesTable = /** @type {HTMLElement} */ ( + this.shadowRoot?.querySelector('#js-content-wrapper') + ); + const button = /** @type {HTMLElement} */ (datesTable.querySelector('[tabindex="0"]')); button.focus(); this.__focusedDate = this.centralDate; }