question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Best way to add picker to page body?

See original GitHub issue

Hi, very cool picker, thank you! Please help - I want to create the picker at the top level of DOM-tree and show/hide it dynamically when the user clicks one of the sub-elements on the page. Can I do it? I want picker to be passive, so it will not listen for clicks, and also I want to position it absolutely, depending on which element was clicked.

I tried to create picker instance on click, then use method ‘show’, and then destroy it onDone.

But currently, the picker tries to add itself as a child of a clickable element, but this absolutely doesn’t work in my case, because the parent element is overflow: hidden and also heavy CSS applied in the area of this element, so picker gets very distorted. (I have an editable tree of properties, and some of these properties are colors)

So, if I will create picker instance with body parent - can I control somehow it’s revealing position?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
YuriGorcommented, Nov 6, 2019

Look ma, auto-positioning! Gist updated. Now popup option, passed into this wrapper function, can be'auto' (by default) or an array of allowed positions ordered by desired priority. 'auto' will be replaced by ['right', 'left', 'bottom', 'top']

Note for @Sphinxxxx - picker doesn’t update popup setting changed via setOptions method, I had to call show method after each setOptions. So you can check inside setOptions if popup was changed then do the same inside.

1reaction
YuriGorcommented, Nov 4, 2019

I refactored your example a bit in a more reusable manner: https://gist.github.com/YuriGor/c413b6d5b6e82554b8a37400a8f6580e Maybe you will consider adding something like this function because it’s self-sufficient and requires no changes in the existing code. It’s missing all those cool features I promoted above, but it’s still useful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to add a Color Picker in HTML
To add a color picker in an HTML page, use an <input> tag with type = 'color' . The initial value can be...
Read more >
How can I change a part of a view after a picker selection?
I would like to change a part of the view after a picker selection and the only way comes to my mind is...
Read more >
How to Display Picker when page load without tapping on ...
but I want to display picker when page load... You could delete the Title to do the same thing. Xaml: <Picker x:Name="selection"> <Picker....
Read more >
Pickers in forms - a free SwiftUI by Example tutorial
SwiftUI's picker views take on special behavior when inside forms, ... options – it's a really natural way of working with many options....
Read more >
<input type="color"> - HTML: HyperText Markup Language
<input type="color" id="body" name="body" ... When a browser doesn't support a color picker interface, ... Methods, select() ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found