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