From a675671353ab9297a5ca0ee3971d38742ad45588 Mon Sep 17 00:00:00 2001 From: Andreas Date: Mon, 4 Nov 2024 20:18:15 +0100 Subject: [PATCH 01/14] Fix typos in tag.md (#2248) --- docs/pages/components/tag.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/pages/components/tag.md b/docs/pages/components/tag.md index 4339ff58..d0026ecd 100644 --- a/docs/pages/components/tag.md +++ b/docs/pages/components/tag.md @@ -31,7 +31,7 @@ const App = () => ( ### Sizes -Use the `size` attribute to change a tab's size. +Use the `size` attribute to change a tag's size. ```html:preview Small @@ -53,7 +53,7 @@ const App = () => ( ### Pill -Use the `pill` attribute to give tabs rounded edges. +Use the `pill` attribute to give tags rounded edges. ```html:preview Small From b70fa163e1d8435fdb6ccde5736757a36769e7af Mon Sep 17 00:00:00 2001 From: Joseph <61133303+zcraber@users.noreply.github.com> Date: Tue, 5 Nov 2024 00:48:47 +0530 Subject: [PATCH 02/14] Fix customizing custom property link (#2252) --- docs/_includes/component.njk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_includes/component.njk b/docs/_includes/component.njk index e377e692..2bc8c002 100644 --- a/docs/_includes/component.njk +++ b/docs/_includes/component.njk @@ -283,7 +283,7 @@ -

Learn more about customizing CSS custom properties.

+

Learn more about customizing CSS custom properties.

{% endif %} {# CSS Parts #} From 569acdb7c9633ee6f410b6d59eb2e076f59b9075 Mon Sep 17 00:00:00 2001 From: Enrico Gruner Date: Mon, 4 Nov 2024 21:51:19 +0100 Subject: [PATCH 03/14] fix possibly leaking eventlisteners (#2257) --- src/components/dialog/dialog.component.ts | 2 +- src/components/drawer/drawer.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/dialog/dialog.component.ts b/src/components/dialog/dialog.component.ts index 0d6c5505..54f62d02 100644 --- a/src/components/dialog/dialog.component.ts +++ b/src/components/dialog/dialog.component.ts @@ -114,7 +114,7 @@ export default class SlDialog extends ShoelaceElement { super.disconnectedCallback(); this.modal.deactivate(); unlockBodyScrolling(this); - this.closeWatcher?.destroy(); + this.removeOpenListeners(); } private requestClose(source: 'close-button' | 'keyboard' | 'overlay') { diff --git a/src/components/drawer/drawer.component.ts b/src/components/drawer/drawer.component.ts index 19365143..21d4207f 100644 --- a/src/components/drawer/drawer.component.ts +++ b/src/components/drawer/drawer.component.ts @@ -131,7 +131,7 @@ export default class SlDrawer extends ShoelaceElement { disconnectedCallback() { super.disconnectedCallback(); unlockBodyScrolling(this); - this.closeWatcher?.destroy(); + this.removeOpenListeners(); } private requestClose(source: 'close-button' | 'keyboard' | 'overlay') { From 8db6580987194291e947f14cf96a0d59dbd1b68e Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Tue, 5 Nov 2024 11:43:32 -0500 Subject: [PATCH 04/14] prevent clicks while dragging; fixes #2196 (#2259) --- docs/pages/resources/changelog.md | 1 + src/components/carousel/carousel.component.ts | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/docs/pages/resources/changelog.md b/docs/pages/resources/changelog.md index b50f906e..a0d39a5d 100644 --- a/docs/pages/resources/changelog.md +++ b/docs/pages/resources/changelog.md @@ -18,6 +18,7 @@ New versions of Shoelace are released as-needed and generally occur when a criti - Fixed a bug in `` that caused the navigation icons to be reversed - Fixed a bug in `` that prevented label changes in `` from updating the controller [#1971] - Fixed a bug in `` that caused a console warning in Firefox when typing [#2107] +- Fixed a bug in `` that caused interactive elements to be activated when dragging [#2196] - Improved performance of `` by skipping positioning logic when tooltip isn't shown [#2064] ## 2.18.0 diff --git a/src/components/carousel/carousel.component.ts b/src/components/carousel/carousel.component.ts index 40234ae3..c9883fa3 100644 --- a/src/components/carousel/carousel.component.ts +++ b/src/components/carousel/carousel.component.ts @@ -92,6 +92,7 @@ export default class SlCarousel extends ShoelaceElement { @state() dragging = false; private autoplayController = new AutoplayController(this, () => this.next()); + private dragStartPosition: [number, number] = [-1, -1]; private readonly localize = new LocalizeController(this); private mutationObserver: MutationObserver; private pendingSlideChange = false; @@ -151,6 +152,20 @@ export default class SlCarousel extends ShoelaceElement { ) as SlCarouselItem[]; } + private handleClick(event: MouseEvent) { + if (this.dragging && this.dragStartPosition[0] > 0 && this.dragStartPosition[1] > 0) { + const deltaX = Math.abs(this.dragStartPosition[0] - event.clientX); + const deltaY = Math.abs(this.dragStartPosition[1] - event.clientY); + const delta = Math.sqrt(deltaX * deltaX + deltaY * deltaY); + + // Prevents clicks on interactive elements while dragging if the click is within a small range. This prevents + // accidental drags from interfering with intentional clicks. + if (delta >= 10) { + event.preventDefault(); + } + } + } + private handleKeyDown(event: KeyboardEvent) { if (['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Home', 'End'].includes(event.key)) { const target = event.target as HTMLElement; @@ -208,6 +223,7 @@ export default class SlCarousel extends ShoelaceElement { // Start dragging if it hasn't yet this.scrollContainer.style.setProperty('scroll-snap-type', 'none'); this.dragging = true; + this.dragStartPosition = [event.clientX, event.clientY]; } this.scrollContainer.scrollBy({ @@ -255,6 +271,7 @@ export default class SlCarousel extends ShoelaceElement { scrollContainer.style.removeProperty('scroll-snap-type'); this.dragging = false; + this.dragStartPosition = [-1, -1]; this.handleScrollEnd(); }); }; @@ -533,6 +550,7 @@ export default class SlCarousel extends ShoelaceElement { @mousedown="${this.handleMouseDragStart}" @scroll="${this.handleScroll}" @scrollend=${this.handleScrollEnd} + @click=${this.handleClick} > From 4580c5bc7c307188c358f2a561adbf2ee6ec0a5f Mon Sep 17 00:00:00 2001 From: Anders Engan Date: Tue, 12 Nov 2024 17:03:01 +0100 Subject: [PATCH 05/14] Adds Norwegian translations (#2268) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add translations for norwegian bokmål * Add translations for norwegian nynorsk --- src/translations/nb.ts | 39 +++++++++++++++++++++++++++++++++++++++ src/translations/nn.ts | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 src/translations/nb.ts create mode 100644 src/translations/nn.ts diff --git a/src/translations/nb.ts b/src/translations/nb.ts new file mode 100644 index 00000000..2fc21f2e --- /dev/null +++ b/src/translations/nb.ts @@ -0,0 +1,39 @@ +import { registerTranslation } from '../utilities/localize.js'; +import type { Translation } from "../utilities/localize.js"; + +const translation: Translation = { + $code: 'nb', + $name: 'Norwegian Bokmål', + $dir: 'ltr', + + carousel: 'Karusell', + clearEntry: 'Tøm felt', + close: 'Lukk', + copied: 'Kopiert', + copy: 'Kopier', + currentValue: 'Nåværende verdi', + error: 'Feil', + goToSlide: (slide, count) => `Gå til visning ${slide} av ${count}`, + hidePassword: 'Skjul passord', + loading: 'Laster', + nextSlide: 'Neste visning', + numOptionsSelected: num => { + if (num === 0) return 'Ingen alternativer valgt'; + if (num === 1) return 'Ett alternativ valgt'; + return `${num} alternativer valgt`; + }, + previousSlide: 'Forrige visning', + progress: 'Fremdrift', + remove: 'Fjern', + resize: 'Endre størrelse', + scrollToEnd: 'Rull til slutten', + scrollToStart: 'Rull til starten', + selectAColorFromTheScreen: 'Velg en farge fra skjermen', + showPassword: 'Vis passord', + slideNum: slide => `Visning ${slide}`, + toggleColorFormat: 'Bytt fargeformat' +}; + +registerTranslation(translation); + +export default translation; diff --git a/src/translations/nn.ts b/src/translations/nn.ts new file mode 100644 index 00000000..636454bb --- /dev/null +++ b/src/translations/nn.ts @@ -0,0 +1,39 @@ +import { registerTranslation } from '../utilities/localize.js'; +import type { Translation } from "../utilities/localize.js"; + +const translation: Translation = { + $code: 'nn', + $name: 'Norwegian Nynorsk', + $dir: 'ltr', + + carousel: 'Karusell', + clearEntry: 'Tøm felt', + close: 'Lukk', + copied: 'Kopiert', + copy: 'Kopier', + currentValue: 'Nåverande verdi', + error: 'Feil', + goToSlide: (slide, count) => `Gå til visning ${slide} av ${count}`, + hidePassword: 'Gøym passord', + loading: 'Lastar', + nextSlide: 'Neste visning', + numOptionsSelected: num => { + if (num === 0) return 'Ingen alternativ valt'; + if (num === 1) return 'Eitt alternativ valt'; + return `${num} alternativ valt`; + }, + previousSlide: 'Førre visning', + progress: 'Framdrift', + remove: 'Fjern', + resize: 'Endre storleik', + scrollToEnd: 'Rull til slutten', + scrollToStart: 'Rull til starten', + selectAColorFromTheScreen: 'Vel ein farge frå skjermen', + showPassword: 'Vis passord', + slideNum: slide => `Visning ${slide}`, + toggleColorFormat: 'Byt fargeformat' +}; + +registerTranslation(translation); + +export default translation; From fc1ab67a34503f7c7e960834a360f99e22beac4c Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Tue, 12 Nov 2024 11:03:56 -0500 Subject: [PATCH 06/14] update changelog --- cspell.json | 1 + docs/pages/resources/changelog.md | 1 + 2 files changed, 2 insertions(+) diff --git a/cspell.json b/cspell.json index ba7ba2e8..a969d686 100644 --- a/cspell.json +++ b/cspell.json @@ -14,6 +14,7 @@ "autoloading", "autoplay", "bezier", + "Bokmål", "boxicons", "CACHEABLE", "callout", diff --git a/docs/pages/resources/changelog.md b/docs/pages/resources/changelog.md index a0d39a5d..5020bdae 100644 --- a/docs/pages/resources/changelog.md +++ b/docs/pages/resources/changelog.md @@ -14,6 +14,7 @@ New versions of Shoelace are released as-needed and generally occur when a criti ## Next +- Added Norwegian translations for Bokmål and Nynorsk [#2268] - Added support for Enter to `` to align with ARIA APG's [window splitter pattern](https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/) [#2234] - Fixed a bug in `` that caused the navigation icons to be reversed - Fixed a bug in `` that prevented label changes in `` from updating the controller [#1971] From 3178dc6278b23b3e56318b5f6bea0a92438816cd Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Tue, 12 Nov 2024 11:05:59 -0500 Subject: [PATCH 07/14] prettier --- src/translations/nb.ts | 2 +- src/translations/nn.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/translations/nb.ts b/src/translations/nb.ts index 2fc21f2e..bf3c06db 100644 --- a/src/translations/nb.ts +++ b/src/translations/nb.ts @@ -1,5 +1,5 @@ import { registerTranslation } from '../utilities/localize.js'; -import type { Translation } from "../utilities/localize.js"; +import type { Translation } from '../utilities/localize.js'; const translation: Translation = { $code: 'nb', diff --git a/src/translations/nn.ts b/src/translations/nn.ts index 636454bb..cbd897cf 100644 --- a/src/translations/nn.ts +++ b/src/translations/nn.ts @@ -1,5 +1,5 @@ import { registerTranslation } from '../utilities/localize.js'; -import type { Translation } from "../utilities/localize.js"; +import type { Translation } from '../utilities/localize.js'; const translation: Translation = { $code: 'nn', From 51473c608efdcd639613e553dd7dd8f842bb2181 Mon Sep 17 00:00:00 2001 From: Alessandro Date: Tue, 12 Nov 2024 17:07:05 +0100 Subject: [PATCH 08/14] fix(carousel): out of order slides when inside sl-resize-observer (#2260) * fix: sync slides after complete initialization * chore: leftover --- src/components/carousel/carousel.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/carousel/carousel.component.ts b/src/components/carousel/carousel.component.ts index c9883fa3..55cbbc1a 100644 --- a/src/components/carousel/carousel.component.ts +++ b/src/components/carousel/carousel.component.ts @@ -381,10 +381,10 @@ export default class SlCarousel extends ShoelaceElement { this.createClones(); } - this.synchronizeSlides(); - // Because the DOM may be changed, restore the scroll position to the active slide this.goToSlide(this.activeSlide, 'auto'); + + this.synchronizeSlides(); } private createClones() { From 8a3006d1c9fbe1b86acdda42f9f73e8323e68763 Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Tue, 12 Nov 2024 11:08:06 -0500 Subject: [PATCH 09/14] update changelog --- docs/pages/resources/changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/pages/resources/changelog.md b/docs/pages/resources/changelog.md index 5020bdae..abedeb21 100644 --- a/docs/pages/resources/changelog.md +++ b/docs/pages/resources/changelog.md @@ -20,6 +20,7 @@ New versions of Shoelace are released as-needed and generally occur when a criti - Fixed a bug in `` that prevented label changes in `` from updating the controller [#1971] - Fixed a bug in `` that caused a console warning in Firefox when typing [#2107] - Fixed a bug in `` that caused interactive elements to be activated when dragging [#2196] +- Fixed a bug in `` that caused out of order slides when used inside a resize observer [#2260] - Improved performance of `` by skipping positioning logic when tooltip isn't shown [#2064] ## 2.18.0 From c232214445093858ceee194dddfd2f45d747caf0 Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Fri, 15 Nov 2024 12:12:54 -0500 Subject: [PATCH 10/14] fix tabindex when readonly; fixes #2271 (#2272) --- docs/pages/resources/changelog.md | 1 + src/components/rating/rating.component.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/pages/resources/changelog.md b/docs/pages/resources/changelog.md index abedeb21..fa962536 100644 --- a/docs/pages/resources/changelog.md +++ b/docs/pages/resources/changelog.md @@ -21,6 +21,7 @@ New versions of Shoelace are released as-needed and generally occur when a criti - Fixed a bug in `` that caused a console warning in Firefox when typing [#2107] - Fixed a bug in `` that caused interactive elements to be activated when dragging [#2196] - Fixed a bug in `` that caused out of order slides when used inside a resize observer [#2260] +- Fixed a bug in `` that allowed tabbing into the rating when readonly [#2271] - Improved performance of `` by skipping positioning logic when tooltip isn't shown [#2064] ## 2.18.0 diff --git a/src/components/rating/rating.component.ts b/src/components/rating/rating.component.ts index 4279cdd5..0e350708 100644 --- a/src/components/rating/rating.component.ts +++ b/src/components/rating/rating.component.ts @@ -240,7 +240,7 @@ export default class SlRating extends ShoelaceElement { aria-valuenow=${this.value} aria-valuemin=${0} aria-valuemax=${this.max} - tabindex=${this.disabled ? '-1' : '0'} + tabindex=${this.disabled || this.readonly ? '-1' : '0'} @click=${this.handleClick} @keydown=${this.handleKeyDown} @mouseenter=${this.handleMouseEnter} From 604526f4654889666846f2246774ec834e46419a Mon Sep 17 00:00:00 2001 From: Volodymyr Lisivka Date: Fri, 15 Nov 2024 20:49:12 +0200 Subject: [PATCH 11/14] Ukrainian translation for shoelace (#2270) * Ukrainian translation is added. * Update message with numerals in uk.ts --- src/translations/uk.ts | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/translations/uk.ts diff --git a/src/translations/uk.ts b/src/translations/uk.ts new file mode 100644 index 00000000..98299d0b --- /dev/null +++ b/src/translations/uk.ts @@ -0,0 +1,41 @@ +import { registerTranslation } from '../utilities/localize.js'; +import type { Translation } from '../utilities/localize.js'; + +const translation: Translation = { + $code: 'uk', + $name: 'Українська', + $dir: 'ltr', + + carousel: 'Карусель', + clearEntry: 'Очистити поле', + close: 'Закрити', + copied: 'Скопійовано', + copy: 'Скопіювати', + currentValue: 'Поточне значення', + error: 'Збій', + goToSlide: (slide, count) => `Перейти до слайда №${slide} з ${count}`, + hidePassword: 'Приховати пароль', + loading: 'Завантаження', + nextSlide: 'Наступний слайд', + numOptionsSelected: num => { + var n = num % 10; + if (n === 0) return 'не вибрано варіантів'; + if (n === 1) return 'вибрано 1 варіант'; + if (n === 2 || n === 3 || n === 4) return `вибрано ${num} варіанти`; + return `вибрано ${num} варіантів`; + }, + previousSlide: 'Попередній слайд', + progress: 'Поступ', + remove: 'Видалити', + resize: 'Змінити розмір', + scrollToEnd: 'Прокрутити в кінець', + scrollToStart: 'Прокрутити на початок', + selectAColorFromTheScreen: 'Виберіть колір на екрані', + showPassword: 'Показати пароль', + slideNum: slide => `Слайд ${slide}`, + toggleColorFormat: 'Переключити кольорову модель' +}; + +registerTranslation(translation); + +export default translation; From 8cbd07b401b733ff40d27f2fbd325e033766f5b1 Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Fri, 15 Nov 2024 13:50:20 -0500 Subject: [PATCH 12/14] prettier / changelog --- docs/pages/resources/changelog.md | 1 + src/translations/uk.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/pages/resources/changelog.md b/docs/pages/resources/changelog.md index fa962536..06cb52c8 100644 --- a/docs/pages/resources/changelog.md +++ b/docs/pages/resources/changelog.md @@ -15,6 +15,7 @@ New versions of Shoelace are released as-needed and generally occur when a criti ## Next - Added Norwegian translations for Bokmål and Nynorsk [#2268] +- Added Ukrainian translation [#2270] - Added support for Enter to `` to align with ARIA APG's [window splitter pattern](https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/) [#2234] - Fixed a bug in `` that caused the navigation icons to be reversed - Fixed a bug in `` that prevented label changes in `` from updating the controller [#1971] diff --git a/src/translations/uk.ts b/src/translations/uk.ts index 98299d0b..5a106d53 100644 --- a/src/translations/uk.ts +++ b/src/translations/uk.ts @@ -18,7 +18,7 @@ const translation: Translation = { loading: 'Завантаження', nextSlide: 'Наступний слайд', numOptionsSelected: num => { - var n = num % 10; + const n = num % 10; if (n === 0) return 'не вибрано варіантів'; if (n === 1) return 'вибрано 1 варіант'; if (n === 2 || n === 3 || n === 4) return `вибрано ${num} варіанти`; From 5fa62bc5bf10b73f5c7822ebebfe433449eaa088 Mon Sep 17 00:00:00 2001 From: Konnor Rogers Date: Tue, 26 Nov 2024 16:28:14 -0500 Subject: [PATCH 13/14] Fix improper tag references in sl-select (#2287) * fix improper tag references in sl-select * update changelog * prettier * remove cem * update changelog * update changelog --- docs/pages/components/select.md | 10 +++++----- docs/pages/resources/changelog.md | 1 + src/components/select/select.component.ts | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/pages/components/select.md b/docs/pages/components/select.md index 15ef3da3..de452824 100644 --- a/docs/pages/components/select.md +++ b/docs/pages/components/select.md @@ -504,17 +504,17 @@ Remember that custom tags are rendered in a shadow root. To style them, you can ### Lazy loading options -Lazy loading options is very hard to get right. `` largely follows how a native `` works. Here are the following conditions: -- If a `` is created without any options, but is given a `value` attribute, its `value` will be `""`, and then when options are added, if any of the options have a value equal to the `` value, the value of the `` will equal that of the option. +- If a `` is created without any options, but is given a `value` attribute, its `value` will be `""`, and then when options are added, if any of the options have a value equal to the `` value, the value of the `` will equal that of the option. -EX: `` will have a value of `""` until `Foo` connects, at which point its value will become `"foo"` when submitting. +EX: `` will have a value of `""` until `Foo` connects, at which point its value will become `"foo"` when submitting. -- If a `` with an initial value has multiple values, but only some of the options are present, it will only respect the options that are present, and if a selected option is loaded in later, _AND_ the value of the select has not changed via user interaction or direct property assignment, it will add the selected option to the form value and to the `.value` of the select. +- If a `` with an initial value has multiple values, but only some of the options are present, it will only respect the options that are present, and if a selected option is loaded in later, _AND_ the value of the select has not changed via user interaction or direct property assignment, it will add the selected option to the form value and to the `.value` of the select. -This can be hard to conceptualize, so heres a fairly large example showing how lazy loaded options work with `` and `` when given initial value attributes. Feel free to play around with it in a codepen. +This can be hard to conceptualize, so heres a fairly large example showing how lazy loaded options work with `` and `` when given initial value attributes. Feel free to play around with it in a codepen. ```html:preview
diff --git a/docs/pages/resources/changelog.md b/docs/pages/resources/changelog.md index 06cb52c8..4b711c1e 100644 --- a/docs/pages/resources/changelog.md +++ b/docs/pages/resources/changelog.md @@ -17,6 +17,7 @@ New versions of Shoelace are released as-needed and generally occur when a criti - Added Norwegian translations for Bokmål and Nynorsk [#2268] - Added Ukrainian translation [#2270] - Added support for Enter to `` to align with ARIA APG's [window splitter pattern](https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/) [#2234] +- Fixed a bug in `` where it was using the wrong tag name,. [#2287] - Fixed a bug in `` that caused the navigation icons to be reversed - Fixed a bug in `` that prevented label changes in `` from updating the controller [#1971] - Fixed a bug in `` that caused a console warning in Firefox when typing [#2107] diff --git a/src/components/select/select.component.ts b/src/components/select/select.component.ts index d91adfb2..3af09dc4 100644 --- a/src/components/select/select.component.ts +++ b/src/components/select/select.component.ts @@ -503,8 +503,8 @@ export default class SlSelect extends ShoelaceElement implements ShoelaceFormCon /* @internal - used by options to update labels */ public handleDefaultSlotChange() { - if (!customElements.get('wa-option')) { - customElements.whenDefined('wa-option').then(() => this.handleDefaultSlotChange()); + if (!customElements.get('sl-option')) { + customElements.whenDefined('sl-option').then(() => this.handleDefaultSlotChange()); } const allOptions = this.getAllOptions(); From 94a1043fb8a766ff4318f047c7c026c29fd8ebdb Mon Sep 17 00:00:00 2001 From: Chris Krawietz Date: Mon, 2 Dec 2024 19:21:07 +0100 Subject: [PATCH 14/14] refactor turbo.js query selector (#2293) Updated esm import of turbo from hotwire & fixed spelling of querySelector --- docs/assets/scripts/turbo.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/assets/scripts/turbo.js b/docs/assets/scripts/turbo.js index 7075217f..6d506ef6 100644 --- a/docs/assets/scripts/turbo.js +++ b/docs/assets/scripts/turbo.js @@ -1,4 +1,4 @@ -import * as Turbo from 'https://cdn.jsdelivr.net/npm/@hotwired/turbo@7.3.0/+esm'; +import * as Turbo from 'https://cdn.jsdelivr.net/npm/@hotwired/turbo@8.0.10/+esm'; (() => { if (!window.scrollPositions) { @@ -6,13 +6,13 @@ import * as Turbo from 'https://cdn.jsdelivr.net/npm/@hotwired/turbo@7.3.0/+esm' } function preserveScroll() { - document.querySelectorAll('[data-preserve-scroll').forEach(element => { + document.querySelectorAll('[data-preserve-scroll]').forEach(element => { scrollPositions[element.id] = element.scrollTop; }); } function restoreScroll(event) { - document.querySelectorAll('[data-preserve-scroll').forEach(element => { + document.querySelectorAll('[data-preserve-scroll]').forEach(element => { element.scrollTop = scrollPositions[element.id]; });