From 252b204adb4148588eabdd28224c451c6069d68e Mon Sep 17 00:00:00 2001 From: Beka Westberg Date: Tue, 21 Mar 2023 10:00:40 -0700 Subject: [PATCH] fix: scrolling dropdown items into view (#6912) * fix: scrolling dropdown items into view * chore: lint --- core/field_dropdown.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/field_dropdown.ts b/core/field_dropdown.ts index 90cd9117a..0650be4c3 100644 --- a/core/field_dropdown.ts +++ b/core/field_dropdown.ts @@ -20,6 +20,7 @@ import {Field, FieldConfig, FieldValidator, UnattachedFieldError} from './field. import * as fieldRegistry from './field_registry.js'; import {Menu} from './menu.js'; import {MenuItem} from './menuitem.js'; +import * as style from './utils/style.js'; import * as aria from './utils/aria.js'; import {Coordinate} from './utils/coordinate.js'; import * as dom from './utils/dom.js'; @@ -283,6 +284,9 @@ export class FieldDropdown extends Field { if (this.selectedMenuItem_) { this.menu_!.setHighlighted(this.selectedMenuItem_); + style.scrollIntoContainerView( + this.selectedMenuItem_.getElement()!, dropDownDiv.getContentDiv(), + true); } this.applyColour();