diff --git a/src/scripts/OSFramework/OSUI/Event/DOMEvents/Listeners/BodyOnScroll.ts b/src/scripts/OSFramework/OSUI/Event/DOMEvents/Listeners/BodyOnScroll.ts deleted file mode 100644 index 72b896a471..0000000000 --- a/src/scripts/OSFramework/OSUI/Event/DOMEvents/Listeners/BodyOnScroll.ts +++ /dev/null @@ -1,23 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-unused-vars -namespace OSFramework.OSUI.Event.DOMEvents.Listeners { - /** - * Class that represents the scroll on the body event. - * - * @export - * @class BodyOnScroll - * @extends {Event.AbstractEvent} - */ - export class BodyOnScroll extends AbstractListener { - constructor() { - super(document.body, GlobalEnum.HTMLEvent.Scroll); - /* Since the scroll can be set to other elements than body, such as ".active-screen" container, we must enable this property in order to ensure it will be "listened" at the body where the event has been set! */ - this.useCapture = true; - this.eventCallback = this._bodyTrigger.bind(this); - } - - // Method to act as callback for the added event and trigger all handlers stored - private _bodyTrigger(evt: Event): void { - this.trigger(GlobalEnum.HTMLEvent.Scroll, evt); - } - } -} diff --git a/src/scripts/OSFramework/OSUI/Event/DOMEvents/Listeners/ListenerEnum.ts b/src/scripts/OSFramework/OSUI/Event/DOMEvents/Listeners/ListenerEnum.ts index aed89e4c58..003bc16e94 100644 --- a/src/scripts/OSFramework/OSUI/Event/DOMEvents/Listeners/ListenerEnum.ts +++ b/src/scripts/OSFramework/OSUI/Event/DOMEvents/Listeners/ListenerEnum.ts @@ -6,9 +6,9 @@ namespace OSFramework.OSUI.Event.DOMEvents.Listeners { export enum Type { BalloonOnToggle = 'balloon.onToggle', BodyOnClick = 'body.onclick', - BodyOnScroll = 'body.onscroll', BodyOnMouseDown = 'body.mousedown', OrientationChange = 'window.onorientationchange', + ScreenOnScroll = 'screen.onscroll', WindowResize = 'window.onresize', } } diff --git a/src/scripts/OSFramework/OSUI/Event/DOMEvents/Listeners/ListenerManager.ts b/src/scripts/OSFramework/OSUI/Event/DOMEvents/Listeners/ListenerManager.ts index ee9c65f715..a43651bc31 100644 --- a/src/scripts/OSFramework/OSUI/Event/DOMEvents/Listeners/ListenerManager.ts +++ b/src/scripts/OSFramework/OSUI/Event/DOMEvents/Listeners/ListenerManager.ts @@ -14,14 +14,14 @@ namespace OSFramework.OSUI.Event.DOMEvents.Listeners { return new BalloonOnToggle(); case Type.BodyOnClick: return new BodyOnClick(); - case Type.BodyOnScroll: - return new BodyOnScroll(); case Type.BodyOnMouseDown: return new BodyOnMouseDown(); case Type.WindowResize: return new WindowResize(); case Type.OrientationChange: return new OrientationChange(); + case Type.ScreenOnScroll: + return new ScreenOnScroll(); default: throw new Error(`The listener ${listenerType} is not supported.`); } diff --git a/src/scripts/OSFramework/OSUI/Event/DOMEvents/Listeners/ScreenOnScroll.ts b/src/scripts/OSFramework/OSUI/Event/DOMEvents/Listeners/ScreenOnScroll.ts new file mode 100644 index 0000000000..7ec75846f4 --- /dev/null +++ b/src/scripts/OSFramework/OSUI/Event/DOMEvents/Listeners/ScreenOnScroll.ts @@ -0,0 +1,21 @@ +// eslint-disable-next-line @typescript-eslint/no-unused-vars +namespace OSFramework.OSUI.Event.DOMEvents.Listeners { + /** + * Class that represents the scroll on the active screen element. + * + * @export + * @class ScreenOnScroll + * @extends {Event.AbstractEvent} + */ + export class ScreenOnScroll extends AbstractListener { + constructor() { + super( Helper.Dom.ClassSelector(document, GlobalEnum.CssClassElements.ActiveScreen), GlobalEnum.HTMLEvent.Scroll); + this.eventCallback = this._screenTrigger.bind(this); + } + + // Method to act as callback for the added event and trigger all handlers stored + private _screenTrigger(evt: Event): void { + this.trigger(GlobalEnum.HTMLEvent.Scroll, evt); + } + } +} diff --git a/src/scripts/OSFramework/OSUI/Pattern/Dropdown/ServerSide/DropdownServerSide.ts b/src/scripts/OSFramework/OSUI/Pattern/Dropdown/ServerSide/DropdownServerSide.ts index 74ea778620..218a1bf0c3 100644 --- a/src/scripts/OSFramework/OSUI/Pattern/Dropdown/ServerSide/DropdownServerSide.ts +++ b/src/scripts/OSFramework/OSUI/Pattern/Dropdown/ServerSide/DropdownServerSide.ts @@ -34,8 +34,6 @@ namespace OSFramework.OSUI.Patterns.Dropdown.ServerSide { private _closeDynamically = false; // Click On Body private _eventOnBodyClick: GlobalCallbacks.Generic; - // Event OnBodyScroll - private _eventOnBodyScroll: GlobalCallbacks.Generic; // Click Event private _eventOnClick: GlobalCallbacks.Generic; private _eventOnClickInputSearch: GlobalCallbacks.Generic; @@ -43,6 +41,8 @@ namespace OSFramework.OSUI.Patterns.Dropdown.ServerSide { private _eventOnCloseTransitionEnd: GlobalCallbacks.Generic; // Event OnOrientationChange Event private _eventOnOrientationChange: GlobalCallbacks.Generic; + // Event OnScreenScroll + private _eventOnScreenScroll: GlobalCallbacks.Generic; // OnSearchInputBlur Event private _eventOnSearchInputBlur: GlobalCallbacks.Generic; // OnSearchInputFocus Event @@ -67,8 +67,6 @@ namespace OSFramework.OSUI.Patterns.Dropdown.ServerSide { private _isOpen = false; // Platform OnClose Callback private _platformEventOnToggleCallback: GlobalCallbacks.OSGeneric; - // Store the RequestAnimationFrame that will be triggered at OnBodyScroll - private _requestAnimationOnBodyScroll: number; // Store the HTML element for the Dropdown Select Wrapper private _selectValuesWrapper: HTMLElement; // Store the SelectValuesWrapper AriaLabel text @@ -118,8 +116,6 @@ namespace OSFramework.OSUI.Patterns.Dropdown.ServerSide { // Update the touchMove when pattern is open! this._touchMove(); - // Cancel the requestAnimationFrame - cancelAnimationFrame(this._requestAnimationOnBodyScroll); // Update status property this._isOpen = false; // Update pattern status! @@ -234,38 +230,6 @@ namespace OSFramework.OSUI.Patterns.Dropdown.ServerSide { } } - // Update the balloon coordinates - private _onBodyScroll(_eventType: string, event: UIEvent): void { - if (this.isBuilt) { - // If the scroll occcurs inside balloonContent, stop all the forward logic! - if (event !== undefined && event.target === this._balloonContentElement) { - cancelAnimationFrame(this._requestAnimationOnBodyScroll); - return; - } - - // If it's open and not at Desktop - if (this._isOpen && Helper.DeviceInfo.IsDesktop === false) { - cancelAnimationFrame(this._requestAnimationOnBodyScroll); - - // If it's tablet close it in order to prevent flickering on updating it's position! - if (Helper.DeviceInfo.IsTablet) { - this._close(); - } - return; - } - - // If the balloon is open and not IsPhone - if (this._isOpen) { - // Update the coordinates - this._setBalloonCoordinates(false); - // Update the "animation" before the next repaint - this._requestAnimationOnBodyScroll = requestAnimationFrame(this._eventOnBodyScroll); - } else { - cancelAnimationFrame(this._requestAnimationOnBodyScroll); - } - } - } - // A11y keyboard keys private _onKeyboardPressed(event: KeyboardEvent): void { event.stopPropagation(); @@ -331,6 +295,21 @@ namespace OSFramework.OSUI.Patterns.Dropdown.ServerSide { } } + // Update the balloon coordinates + private _onScreenScroll(): void { + if (this.isBuilt && this._isOpen) { + // If it's tablet close it in order to prevent flickering on updating it's position! + if (Helper.DeviceInfo.IsTablet) { + this._close(); + return; + } + + // If the balloon is open and Desktop + // Update the coordinates + requestAnimationFrame(this._setBalloonCoordinates.bind(this)); + } + } + // Also Used to manage the balloon height accordingly keyboard is in use due to the way iOS deal with it! private _onSearchInputBlur(): void { Helper.Dom.Styles.RemoveClass(this._balloonWrapperElement, Enum.CssClass.SearchInputIsFocused); @@ -521,10 +500,7 @@ namespace OSFramework.OSUI.Patterns.Dropdown.ServerSide { selfElement.right === this._selfElementBoundingClientRect.x + this._selfElementBoundingClientRect.width && selfElement.y === this._selfElementBoundingClientRect.y) - ) { - cancelAnimationFrame(this._requestAnimationOnBodyScroll); - return; - } + ) // Store the new selElement coordinates this._selfElementBoundingClientRect.x = selfElement.x; @@ -667,15 +643,15 @@ namespace OSFramework.OSUI.Patterns.Dropdown.ServerSide { Event.DOMEvents.Listeners.Type.BodyOnClick, this._eventOnBodyClick ); + + if(Helper.DeviceInfo.IsPhone === false) { + // Add the ScreenScroll callback that will be used to update the balloon coodinates + Event.DOMEvents.Listeners.GlobalListenerManager.Instance.addHandler( + Event.DOMEvents.Listeners.Type.ScreenOnScroll, + this._eventOnScreenScroll + ); + } - // Add the BodyScroll callback that will be used to update the balloon coodinates - Event.DOMEvents.Listeners.GlobalListenerManager.Instance.addHandler( - Event.DOMEvents.Listeners.Type.BodyOnScroll, - this._eventOnBodyScroll - ); - - // Update "animation" before the next repaint - this._requestAnimationOnBodyScroll = requestAnimationFrame(this._eventOnBodyScroll); // Add the window resize callback that will be used to update the balloon position! Event.DOMEvents.Listeners.GlobalListenerManager.Instance.addHandler( Event.DOMEvents.Listeners.Type.WindowResize, @@ -747,10 +723,14 @@ namespace OSFramework.OSUI.Patterns.Dropdown.ServerSide { Event.DOMEvents.Listeners.Type.BodyOnClick, this._eventOnBodyClick ); - Event.DOMEvents.Listeners.GlobalListenerManager.Instance.removeHandler( - Event.DOMEvents.Listeners.Type.BodyOnScroll, - this._eventOnBodyScroll - ); + + if(Helper.DeviceInfo.IsPhone === false) { + Event.DOMEvents.Listeners.GlobalListenerManager.Instance.removeHandler( + Event.DOMEvents.Listeners.Type.ScreenOnScroll, + this._eventOnScreenScroll + ); + } + Event.DOMEvents.Listeners.GlobalListenerManager.Instance.removeHandler( Event.DOMEvents.Listeners.Type.WindowResize, this._eventOnWindowResize @@ -927,7 +907,7 @@ namespace OSFramework.OSUI.Patterns.Dropdown.ServerSide { */ protected setCallbacks(): void { this._eventOnBodyClick = this._onBodyClick.bind(this); - this._eventOnBodyScroll = this._onBodyScroll.bind(this); + this._eventOnScreenScroll = this._onScreenScroll.bind(this); this._eventOnClick = this._onSelectValuesWrapperClicked.bind(this); this._eventOnClickInputSearch = this._onSearchInputClicked.bind(this); this._eventOnCloseTransitionEnd = this._endOfCloseAnimation.bind(this); @@ -995,7 +975,7 @@ namespace OSFramework.OSUI.Patterns.Dropdown.ServerSide { */ protected unsetCallbacks(): void { this._eventOnBodyClick = undefined; - this._eventOnBodyScroll = undefined; + this._eventOnScreenScroll = undefined; this._eventOnClick = undefined; this._eventOnClickInputSearch = undefined; this._eventOnCloseTransitionEnd = undefined; diff --git a/src/scripts/OSFramework/OSUI/Pattern/SectionIndexItem/SectionIndexItem.ts b/src/scripts/OSFramework/OSUI/Pattern/SectionIndexItem/SectionIndexItem.ts index a308ff5837..8598ea6355 100644 --- a/src/scripts/OSFramework/OSUI/Pattern/SectionIndexItem/SectionIndexItem.ts +++ b/src/scripts/OSFramework/OSUI/Pattern/SectionIndexItem/SectionIndexItem.ts @@ -12,10 +12,10 @@ namespace OSFramework.OSUI.Patterns.SectionIndexItem { extends AbstractChild implements ISectionIndexItem { - // Event OnBodyScroll - private _eventOnBodyScroll: GlobalCallbacks.Generic; // Store the on click event private _eventOnClick: GlobalCallbacks.Generic; + // Event OnScreenScroll + private _eventOnScreenScroll: GlobalCallbacks.Generic; //Stores the keyboard callback function private _eventOnkeyBoardPress: GlobalCallbacks.Generic; // Store the header size if it's fixed! @@ -38,13 +38,23 @@ namespace OSFramework.OSUI.Patterns.SectionIndexItem { super(uniqueId, new SectionIndexItemConfig(configs)); } - /** - * Method to check the scroll to know if the target element is visible and sets the item as active - * - * @private - * @memberof SectionIndexItem - */ - private _onBodyScroll(): void { + // Method to set the A11y keyboard navigation + private _onKeyboardPressed(event: KeyboardEvent): void { + event.preventDefault(); + event.stopPropagation(); + + switch (event.key) { + // If Enter or Space Keys trigger as a click event! + case GlobalEnum.Keycodes.Enter: + case GlobalEnum.Keycodes.Space: + // Triggered as it was clicked! + this._onSelected(event); + break; + } + } + + // Method to check the scroll to know if the target element is visible and sets the item as active + private _onScreenScroll(): void { // Set target element offset info! this._setTargetOffsetInfo(); // Get the vertical scroll position value @@ -62,7 +72,7 @@ namespace OSFramework.OSUI.Patterns.SectionIndexItem { - AND; - If scroll has hit the bottom and element doesn't have height enought to be placed at that offset it should set it as IsActive since it will be the last item in screen inside the scrollContainer. - */ + */ if ( (this.isFirstChild && scrollYPosition.percentageInView === 0) || (elementOffsetTopVal >= -thresholdVal && elementOffsetTopVal <= thresholdVal) || @@ -72,34 +82,7 @@ namespace OSFramework.OSUI.Patterns.SectionIndexItem { } } - /** - * Method to set the A11y keyboard navigation - * - * @private - * @param {KeyboardEvent} event - * @memberof SectionIndexItem - */ - private _onKeyboardPressed(event: KeyboardEvent): void { - event.preventDefault(); - event.stopPropagation(); - - switch (event.key) { - // If Enter or Space Keys trigger as a click event! - case GlobalEnum.Keycodes.Enter: - case GlobalEnum.Keycodes.Space: - // Triggered as it was clicked! - this._onSelected(event); - break; - } - } - - /** - * Method to handle the click event - * - * @private - * @param {Event} event - * @memberof SectionIndexItem - */ + // Method to handle the click event private _onSelected(event: Event): void { event.preventDefault(); event.stopPropagation(); @@ -111,27 +94,17 @@ namespace OSFramework.OSUI.Patterns.SectionIndexItem { this.notifyParent(SectionIndex.Enum.ChildNotifyActionType.Click); } - /** - * Method to remove Pattern events - * - * @private - * @memberof SectionIndexItem - */ + // Method to remove Pattern events private _removeEvents(): void { this.selfElement.removeEventListener(GlobalEnum.HTMLEvent.Click, this._eventOnClick); this.selfElement.removeEventListener(GlobalEnum.HTMLEvent.keyDown, this._eventOnkeyBoardPress); Event.DOMEvents.Listeners.GlobalListenerManager.Instance.removeHandler( - Event.DOMEvents.Listeners.Type.BodyOnScroll, - this._eventOnBodyScroll + Event.DOMEvents.Listeners.Type.ScreenOnScroll, + this._eventOnScreenScroll ); } - /** - * Method to check if header IsFixed - * - * @private - * @memberof SectionIndexItem - */ + // Method to check if header IsFixed private _setHeaderSize(): void { const header = Helper.Dom.ClassSelector(document.body, GlobalEnum.CssClassElements.Header); this._headerIsFixed = !!Helper.Dom.ClassSelector(document.body, GlobalEnum.CssClassElements.HeaderIsFixed); @@ -142,23 +115,12 @@ namespace OSFramework.OSUI.Patterns.SectionIndexItem { } } - /** - * Method to add a data attribute to be used in automated tests - * and to have info on DOM of which element the index is pointing - * - * @private - * @memberof SectionIndexItem - */ + // Method to add a data attribute to be used in automated tests and to have info on DOM of which element the index is pointing private _setLinkAttribute(): void { Helper.Dom.Attribute.Set(this.selfElement, Enum.DataTypes.dataItem, this.configs.ScrollToWidgetId); } - /** - * Method to set the TargetElement - * - * @private - * @memberof SectionIndexItem - */ + // Method to set the TargetElement private _setTargetElement(): void { // Check if the element has been already defined! if (this._targetElement === undefined) { @@ -174,12 +136,7 @@ namespace OSFramework.OSUI.Patterns.SectionIndexItem { } } - /** - * Method to set the offset info related with TargetElement - * - * @private - * @memberof SectionIndexItem - */ + // Method to set the offset info related with TargetElement private _setTargetOffsetInfo(): void { // Check if TargetElement has been already defined, otherwise define it! this._setTargetElement(); @@ -192,19 +149,14 @@ namespace OSFramework.OSUI.Patterns.SectionIndexItem { this._targetElement.offsetTop + this._headerHeight + (this.parentObject.contentPaddingTop as number); } - /** - * Method to set the event listeners - * - * @private - * @memberof SectionIndexItem - */ + // Method to set the event listeners private _setUpEvents(): void { this.selfElement.addEventListener(GlobalEnum.HTMLEvent.Click, this._eventOnClick); this.selfElement.addEventListener(GlobalEnum.HTMLEvent.keyDown, this._eventOnkeyBoardPress); // Add the BodyScroll callback that will be used to update the balloon coodinates Event.DOMEvents.Listeners.GlobalListenerManager.Instance.addHandler( - Event.DOMEvents.Listeners.Type.BodyOnScroll, - this._eventOnBodyScroll + Event.DOMEvents.Listeners.Type.ScreenOnScroll, + this._eventOnScreenScroll ); } @@ -230,7 +182,7 @@ namespace OSFramework.OSUI.Patterns.SectionIndexItem { protected setCallbacks(): void { this._eventOnClick = this._onSelected.bind(this); this._eventOnkeyBoardPress = this._onKeyboardPressed.bind(this); - this._eventOnBodyScroll = this._onBodyScroll.bind(this); + this._eventOnScreenScroll = this._onScreenScroll.bind(this); } /** @@ -269,7 +221,7 @@ namespace OSFramework.OSUI.Patterns.SectionIndexItem { this._eventOnClick = undefined; this._eventOnkeyBoardPress = undefined; - this._eventOnBodyScroll = undefined; + this._eventOnScreenScroll = undefined; } /** diff --git a/src/scripts/OSFramework/OSUI/Pattern/Tooltip/Tooltip.ts b/src/scripts/OSFramework/OSUI/Pattern/Tooltip/Tooltip.ts index 2add222228..506a14cac0 100644 --- a/src/scripts/OSFramework/OSUI/Pattern/Tooltip/Tooltip.ts +++ b/src/scripts/OSFramework/OSUI/Pattern/Tooltip/Tooltip.ts @@ -17,14 +17,14 @@ namespace OSFramework.OSUI.Patterns.Tooltip { private _eventOnBlur: GlobalCallbacks.Generic; // Event OnBodyClick private _eventOnBodyClick: GlobalCallbacks.Generic; - // Event OnBodyScroll - private _eventOnBodyScroll: GlobalCallbacks.Generic; // Event OnPatternClick private _eventOnClick: GlobalCallbacks.Generic; // Event OnPatternFocus private _eventOnFocus: GlobalCallbacks.Generic; // Event OnOpendBalloon private _eventOnOpenedBalloon: GlobalCallbacks.Generic; + // Event OnScreenScroll + private _eventOnScreenScroll: GlobalCallbacks.Generic; // On WindowResize Event private _eventOnWindowResize: GlobalCallbacks.Generic; // Set the observer that will check if the balloon is inside screen boundaries! @@ -162,28 +162,6 @@ namespace OSFramework.OSUI.Patterns.Tooltip { } } - // Update the balloon coordinates - private _onBodyScroll(): void { - if (this.isBuilt) { - // If it's open and not at Desktop, close it! - if (this._isOpen && Helper.DeviceInfo.IsDesktop === false) { - cancelAnimationFrame(this._requestAnimationOnBodyScroll); - this._triggerClose(); - return; - } - - // If the balloon is open and not IsPhone - if (this._isOpen) { - // Update the coordinates - this._setBalloonCoordinates(); - // Update the "animation" before the next repaint - this._requestAnimationOnBodyScroll = requestAnimationFrame(this._eventOnBodyScroll); - } else { - cancelAnimationFrame(this._requestAnimationOnBodyScroll); - } - } - } - // Trigger the tooltip at onClick behaviour private _onClick(e: MouseEvent): void { e.stopPropagation(); @@ -227,6 +205,28 @@ namespace OSFramework.OSUI.Patterns.Tooltip { Helper.Dom.Styles.RemoveClass(this._tooltipBalloonWrapperElem, Enum.CssClass.BalloonIsOpening); } + // Update the balloon coordinates + private _onScreenScroll(): void { + if (this.isBuilt) { + // If it's open and not at Desktop, close it! + if (this._isOpen && Helper.DeviceInfo.IsDesktop === false) { + cancelAnimationFrame(this._requestAnimationOnBodyScroll); + this._triggerClose(); + return; + } + + // If the balloon is open and not IsPhone + if (this._isOpen) { + // Update the coordinates + this._setBalloonCoordinates(); + // Update the "animation" before the next repaint + this._requestAnimationOnBodyScroll = requestAnimationFrame(this._eventOnScreenScroll); + } else { + cancelAnimationFrame(this._requestAnimationOnBodyScroll); + } + } + } + // Manage the behaviour when there is a window resize! private _onWindowResize(): void { // Update Coordinates @@ -381,13 +381,13 @@ namespace OSFramework.OSUI.Patterns.Tooltip { this._tooltipIconElem.addEventListener(GlobalEnum.HTMLEvent.Focus, this._eventOnFocus); } - // Add the BodyScroll callback that will be used to update the balloon coodinates + // Add the ScreenScroll callback that will be used to update the balloon coodinates Event.DOMEvents.Listeners.GlobalListenerManager.Instance.addHandler( - Event.DOMEvents.Listeners.Type.BodyOnScroll, - this._eventOnBodyScroll + Event.DOMEvents.Listeners.Type.ScreenOnScroll, + this._eventOnScreenScroll ); // Update "animation" before the next repaint - this._requestAnimationOnBodyScroll = requestAnimationFrame(this._eventOnBodyScroll); + this._requestAnimationOnBodyScroll = requestAnimationFrame(this._eventOnScreenScroll); // Add the window resize callback that will be used update the balloon position! Event.DOMEvents.Listeners.GlobalListenerManager.Instance.addHandler( @@ -536,8 +536,8 @@ namespace OSFramework.OSUI.Patterns.Tooltip { this._eventOnBodyClick ); Event.DOMEvents.Listeners.GlobalListenerManager.Instance.removeHandler( - Event.DOMEvents.Listeners.Type.BodyOnScroll, - this._eventOnBodyScroll + Event.DOMEvents.Listeners.Type.ScreenOnScroll, + this._eventOnScreenScroll ); Event.DOMEvents.Listeners.GlobalListenerManager.Instance.removeHandler( @@ -634,7 +634,7 @@ namespace OSFramework.OSUI.Patterns.Tooltip { this._eventOnBalloonClick = this._onBalloonClick.bind(this); this._eventOnBlur = this._onBlur.bind(this); this._eventOnBodyClick = this._onBodyClick.bind(this); - this._eventOnBodyScroll = this._onBodyScroll.bind(this); + this._eventOnScreenScroll = this._onScreenScroll.bind(this); this._eventOnClick = this._onClick.bind(this); this._eventOnFocus = this._onFocus.bind(this); this._eventOnOpenedBalloon = this._onOpenedBalloon.bind(this); @@ -693,7 +693,7 @@ namespace OSFramework.OSUI.Patterns.Tooltip { this._eventOnBalloonClick = undefined; this._eventOnBlur = undefined; this._eventOnBodyClick = undefined; - this._eventOnBodyScroll = undefined; + this._eventOnScreenScroll = undefined; this._eventOnClick = undefined; this._eventOnFocus = undefined; this._eventOnOpenedBalloon = undefined; diff --git a/src/scripts/Providers/OSUI/SharedProviderResources/Flatpickr/UpdatePositionOnScroll.ts b/src/scripts/Providers/OSUI/SharedProviderResources/Flatpickr/UpdatePositionOnScroll.ts index 63811392e8..ddecd5b2d7 100644 --- a/src/scripts/Providers/OSUI/SharedProviderResources/Flatpickr/UpdatePositionOnScroll.ts +++ b/src/scripts/Providers/OSUI/SharedProviderResources/Flatpickr/UpdatePositionOnScroll.ts @@ -1,8 +1,8 @@ // eslint-disable-next-line @typescript-eslint/no-unused-vars namespace Providers.OSUI.SharedProviderResources.Flatpickr { export class UpdatePositionOnScroll { - // Event OnBodyScroll - private _onBodyScrollEvent: OSFramework.OSUI.GlobalCallbacks.Generic; + // Event OnScreenScroll + private _onScreenScrollEvent: OSFramework.OSUI.GlobalCallbacks.Generic; // Store the picker instance private _picker: | Datepicker.Flatpickr.IFlatpickr @@ -26,14 +26,14 @@ namespace Providers.OSUI.SharedProviderResources.Flatpickr { } // Update the calendar position - private _onBodyScroll(): void { + private _onScreenScroll(): void { if (this._picker.isBuilt) { // If the calendar is open! if (this._picker.provider.isOpen) { // trigger provider update position method this._picker.provider._positionCalendar(); // Update the "position" before the next "repaint" - this._requestAnimationOnBodyScroll = requestAnimationFrame(this._onBodyScrollEvent); + this._requestAnimationOnBodyScroll = requestAnimationFrame(this._onScreenScrollEvent); } else { cancelAnimationFrame(this._requestAnimationOnBodyScroll); } @@ -42,28 +42,28 @@ namespace Providers.OSUI.SharedProviderResources.Flatpickr { // Method used to set callbacks private _setCallbacks(): void { - this._onBodyScrollEvent = this._onBodyScroll.bind(this); + this._onScreenScrollEvent = this._onScreenScroll.bind(this); } // Add Events private _setUpEvents(): void { // Add the BodyScroll callback that will be used to update the balloon coodinates OSFramework.OSUI.Event.DOMEvents.Listeners.GlobalListenerManager.Instance.addHandler( - OSFramework.OSUI.Event.DOMEvents.Listeners.Type.BodyOnScroll, - this._onBodyScrollEvent + OSFramework.OSUI.Event.DOMEvents.Listeners.Type.ScreenOnScroll, + this._onScreenScrollEvent ); } // Method used to unset callbacks private _unsetCallbacks(): void { - this._onBodyScrollEvent = undefined; + this._onScreenScrollEvent = undefined; } // Remove Added Events private _unsetEvents(): void { OSFramework.OSUI.Event.DOMEvents.Listeners.GlobalListenerManager.Instance.removeHandler( - OSFramework.OSUI.Event.DOMEvents.Listeners.Type.BodyOnScroll, - this._onBodyScrollEvent + OSFramework.OSUI.Event.DOMEvents.Listeners.Type.ScreenOnScroll, + this._onScreenScrollEvent ); } @@ -76,7 +76,7 @@ namespace Providers.OSUI.SharedProviderResources.Flatpickr { this._unsetEvents(); this._unsetCallbacks(); - this._onBodyScrollEvent = undefined; + this._onScreenScrollEvent = undefined; this._requestAnimationOnBodyScroll = undefined; } }