Skip to content

Commit

Permalink
fix(ui5-popover): fix popover going out of the viewport (#8735)
Browse files Browse the repository at this point in the history
  • Loading branch information
TeodorTaushanov committed Apr 12, 2024
1 parent 8b13dd3 commit bca8f2a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/base/src/util/clamp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
* @returns {number}
*/
const clamp = (val: number, min: number, max: number) => {
return Math.min(Math.max(val, min), max);
// handles case when max < min
return Math.min(Math.max(val, min), Math.max(min, max));
};

export default clamp;

0 comments on commit bca8f2a

Please sign in to comment.