Home > widget-integration > PositionService
PositionService class
Service for calculating ISW dropdown position.
Technical Support teams can extend this service for custom positioning:
Signature:
export declare class PositionService
Example
window.boostWidgetIntegration.extend('PositionService', (PositionService) => {
return class CustomPositionService extends PositionService {
// Add custom offset for a specific theme
protected getGap() {
return window.myThemeConfig?.iswGap || super.getGap();
}
};
});
Constructors
|
Constructor |
Modifiers |
Description |
|---|---|---|
|
Constructs a new instance of the |
Properties
|
Property |
Modifiers |
Type |
Description |
|---|---|---|---|
|
| |||
|
|
(not declared) |
Border width compensation | |
|
|
(not declared) |
Bottom margin for viewport calculation | |
|
|
(not declared) |
Default z-index for dropdown | |
|
|
(not declared) |
Gap between input and dropdown | |
|
|
(not declared) |
Reduced z-index when below header | |
|
|
(not declared) |
Scroll debounce delay in ms |
Methods
|
Method |
Modifiers |
Description |
|---|---|---|
|
Apply max height to the results container inside the dropdown. | ||
|
Apply position styles to an element. | ||
|
|
Calculate position when ISW is appended to body. | |
|
|
Calculate position when ISW is inside a dialog. | |
|
Calculate maximum height for the dropdown. **Legacy**: calcMaxHeightByStyle - Hard-coded values based on style **New**: Configurable with style-specific constraints and suggestionMaxHeight support | ||
|
Calculate dropdown position relative to the input element. **Legacy**: calcPositionSuggestionResult(context, input) - inline calculation **New**: Separated service with configurable offsets | ||
|
|
Calculate z-index based on scroll position relative to header. When the search form scrolls behind the header, reduce z-index to prevent overlap issues. | |
|
Calculate suggested dropdown width based on input element. | ||
|
Clean up scroll handler. | ||
|
Cleanup all resources. | ||
|
|
Get border width compensation. Override for themes with different borders. | |
|
Get the ISW container element for the current device. | ||
|
|
Get gap between input and dropdown. Override for custom spacing. | |
|
Check if an element is inside a dialog. | ||
|
Check if ISW element has been moved to dialog. | ||
|
|
Check if current device is mobile or tablet (≤ 991 px). Matches the legacy | |
|
|
Determine if dropdown should be right-aligned. | |
|
Check if the current style is full width. **Legacy**: isStyleFullWidth(context) **New**: Single authoritative method — delegates from InstantSearchSelectors | ||
|
|
Log debug messages when debug mode is enabled. | |
|
Enable or disable debug logging. | ||
|
Set up scroll handler to adjust z-index when scrolling. **Legacy**: Inline scroll handler with debounce in calcPositionSuggestionResult **New**: Dedicated method with proper cleanup | ||
|
Full position update flow: calculate, apply, and setup scroll handler. |