mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-18 22:10:36 +03:00
fix typo
This commit is contained in:
@@ -15,7 +15,7 @@ import {
|
||||
runEachAndClear,
|
||||
} from 'support';
|
||||
|
||||
type DOMContentObserverCallback = (contentChangedTroughEvent: boolean) => any;
|
||||
type DOMContentObserverCallback = (contentChangedThroughEvent: boolean) => any;
|
||||
|
||||
type DOMTargetObserverCallback = (targetChangedAttrs: string[], targetStyleChanged: boolean) => any;
|
||||
|
||||
|
||||
@@ -33,11 +33,11 @@ import {
|
||||
} from 'classnames';
|
||||
import { getEnvironment } from 'environment';
|
||||
import { getPlugins, scrollbarsHidingPluginName } from 'plugins';
|
||||
import type { ScrollbarsHidingPluginInstance } from 'plugins/scrollbarsHidingPlugin';
|
||||
import {
|
||||
staticInitializationElement as generalStaticInitializationElement,
|
||||
dynamicInitializationElement as generalDynamicInitializationElement,
|
||||
} from 'initialization';
|
||||
import type { ScrollbarsHidingPluginInstance } from 'plugins/scrollbarsHidingPlugin';
|
||||
import type {
|
||||
InitializationTarget,
|
||||
InitializationTargetElement,
|
||||
|
||||
@@ -186,13 +186,13 @@ export const createStructureSetupObservers = (
|
||||
|
||||
updateFn({ _sizeChanged, _directionChanged: directionChanged });
|
||||
};
|
||||
const onContentMutation = (contentChangedTroughEvent: boolean, fromRecords?: true) => {
|
||||
const onContentMutation = (contentChangedThroughEvent: boolean, fromRecords?: true) => {
|
||||
const [, contentSizeChanged] = updateContentSizeCache();
|
||||
const updateHints: Partial<StructureSetupUpdateHints> = {
|
||||
_contentMutation: contentSizeChanged,
|
||||
};
|
||||
// if contentChangedTroughEvent is true its already debounced
|
||||
const updateFn = contentChangedTroughEvent
|
||||
// if contentChangedThroughEvent is true its already debounced
|
||||
const updateFn = contentChangedThroughEvent
|
||||
? structureSetupUpdate
|
||||
: structureSetupUpdateWithDebouncedAdaptiveUpdateHints;
|
||||
|
||||
|
||||
+8
-3
@@ -130,9 +130,14 @@ const assertCorrectDOMStructure = (targetType: TargetType, viewportIsTarget: boo
|
||||
};
|
||||
|
||||
const createStructureSetupElementsProxy = (
|
||||
target: InitializationTarget
|
||||
target: InitializationTarget,
|
||||
tabindex?: boolean
|
||||
): StructureSetupElementsProxy => {
|
||||
const [elements, appendElements, destroy] = createStructureSetupElements(target);
|
||||
// simulate tabindex inheritance from host via mutation observer
|
||||
if (tabindex) {
|
||||
elements._viewport.setAttribute('tabindex', elements._target.getAttribute('tabindex')!);
|
||||
}
|
||||
appendElements();
|
||||
return {
|
||||
input: target,
|
||||
@@ -1117,13 +1122,13 @@ describe('structureSetup.elements', () => {
|
||||
const target = document.body.firstElementChild as HTMLElement;
|
||||
target.focus();
|
||||
|
||||
const { elements } = createStructureSetupElementsProxy(target);
|
||||
const { elements } = createStructureSetupElementsProxy(target, true);
|
||||
expect(elements._viewport.getAttribute('tabindex')).toBe('-1');
|
||||
expect(document.activeElement).toBe(elements._viewport);
|
||||
|
||||
elements._documentElm.dispatchEvent(new Event('keydown'));
|
||||
|
||||
expect(elements._viewport.getAttribute('tabindex')).toBe(null);
|
||||
expect(elements._viewport.getAttribute('tabindex')).toBe('123');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user