Skip to content

Commit

Permalink
fix(Slider): range thumbs being stuck when min/max values overlap (#1075
Browse files Browse the repository at this point in the history
)
  • Loading branch information
dgonzalezr authored May 30, 2024
1 parent 177a72a commit 8ac403d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/beeq/src/components/slider/bq-slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,17 @@ export class BqSlider {
};

private renderInput = (type: 'max' | 'min', value: number, refCallback: (input: HTMLInputElement) => void) => {
// Determine the zIndex value based on the type and the current min and max values.
const zIndexValue = (type: 'min' | 'max'): string => {
const zIndex = {
min: this.minValue === this.min && this.maxValue === this.minValue,
max: this.maxValue === this.max && this.minValue === this.maxValue,
};

// If the value of both thumbs is the same as the min or max value, set the zIndex to -1
return zIndex[type] ? '-1' : '0';
};

return (
<input
type="range"
Expand All @@ -336,6 +347,7 @@ export class BqSlider {
true,
'pointer-events-none': this.isRangeType,
}}
style={{ zIndex: zIndexValue(type) }}
disabled={this.disabled}
min={this.min}
max={this.max}
Expand Down

0 comments on commit 8ac403d

Please sign in to comment.