From d2a49c71de441f830f436efa2484affc60f9680a Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Fri, 26 Nov 2021 02:48:14 +0300 Subject: [PATCH] Do not stick picker to the right edge if it is too wide --- Picker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Picker.js b/Picker.js index c933b41..16de04d 100644 --- a/Picker.js +++ b/Picker.js @@ -4,7 +4,7 @@ // ...Or maybe a button with a popup menu // License: LGPLv3.0+ // (c) Vitaliy Filippov 2019+ -// Version 2021-11-17 +// Version 2021-11-26 import React from 'react'; import ReactDOM from 'react-dom'; @@ -261,7 +261,7 @@ export default class Picker extends React.Component let left = (input_pos.left + (props.usePortal ? (window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft) : 0) - (document.documentElement.clientLeft || document.body.clientLeft || 0)); - if (left + width > screen_width) + if (left + width > screen_width && width <= screen_width) { left = screen_width - width; }