Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent year scroller from getting focused in Chrome (#8174) (CP: 24.4) #8179

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions packages/date-picker/src/vaadin-infinite-scroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
*/
import { timeOut } from '@vaadin/component-base/src/async.js';
import { isFirefox } from '@vaadin/component-base/src/browser-utils.js';
import { Debouncer } from '@vaadin/component-base/src/debounce.js';
import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';

Expand Down Expand Up @@ -54,7 +53,7 @@ template.innerHTML = `
}
</style>

<div id="scroller">
<div id="scroller" tabindex="-1">
<div class="buffer"></div>
<div class="buffer"></div>
<div id="fullHeight"></div>
Expand Down Expand Up @@ -198,12 +197,6 @@ export class InfiniteScroller extends HTMLElement {
this._buffers = [...this.shadowRoot.querySelectorAll('.buffer')];

this.$.fullHeight.style.height = `${this._initialScroll * 2}px`;

// Firefox interprets elements with overflow:auto as focusable
// https://bugzilla.mozilla.org/show_bug.cgi?id=1069739
if (isFirefox) {
this.$.scroller.tabIndex = -1;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* @web/test-runner snapshot v1 */
export const snapshots = {};

snapshots["vaadin-date-picker-year-scroller shadow default"] =
`<div
id="scroller"
tabindex="-1"
>
<div class="buffer">
</div>
<div class="buffer">
</div>
<div
id="fullHeight"
style="height: 1e+06px;"
>
</div>
</div>
`;
/* end snapshot vaadin-date-picker-year-scroller shadow default */

18 changes: 18 additions & 0 deletions packages/date-picker/test/dom/date-picker-year-scroller.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { expect } from '@esm-bundle/chai';
import { fixtureSync, nextFrame } from '@vaadin/testing-helpers';
import '../../src/vaadin-date-picker-year-scroller.js';

describe('vaadin-date-picker-year-scroller', () => {
let yearScroller;

beforeEach(async () => {
yearScroller = fixtureSync('<vaadin-date-picker-year-scroller></vaadin-date-picker-year-scroller>');
await nextFrame();
});

describe('shadow', () => {
it('default', async () => {
await expect(yearScroller).shadowDom.to.equalSnapshot();
});
});
});