Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropdown position is incorrect when element enters fullscreen mode #1108

Closed
3 tasks done
dirslashls opened this issue Aug 28, 2022 · 8 comments
Closed
3 tasks done

Dropdown position is incorrect when element enters fullscreen mode #1108

dirslashls opened this issue Aug 28, 2022 · 8 comments
Labels

Comments

@dirslashls
Copy link

Prerequisites

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

馃挜 Demo Page

https://jsbin.com/sovoceremu/1

Explanation

Access the above demo page and click the "Fullscreen" button. This should show the UI in fullscreen.

  • What is the expected behavior?
    The dropdown should be positioned correctly when using fullscreen API.

  • What is happening instead?
    The dropdown is not at the correct place.

  • What error message are you getting?
    No errors.

The issue is how the top and left values are calculated at

while(p){

Current logic assumes to go all the way to the root. But when an element is requested to be in fullscreen mode, then any parent element of it doesn't matter as far as left/top values are concerned. I am not sure if I can do something in the app so Tagify doesn't have to make any change.

@yairEO
Copy link
Owner

yairEO commented Aug 29, 2022

Clicking the button does nothing on my computer (Chrome/Windows10)

@dirslashls
Copy link
Author

Sorry about that. It seems an element within an iframe can't make a fullscreen request unless the iframe markup explicitly specifies allow="fullscreen". I couldn't do that with jsbin but can do it with jsfiddle.

Please visit https://jsfiddle.net/k7n1tmhw/ , then from dev tools change the iframe (name="result"). Look for existing "allow" attribute and just add fullscreen as an extra value. Then the button will launch fullscreen mode. In case all of this is tedious, you can just copy the html, css and javascript locally and do it without any of this iframe stuff.

@yairEO
Copy link
Owner

yairEO commented Aug 30, 2022

jsbin can discard the iframe by clicking on the top right arrow:

image
I can see the issue now and will resolve it in the coming days when I have time

@yairEO yairEO added the Bug label Aug 30, 2022
@yairEO
Copy link
Owner

yairEO commented Aug 30, 2022

This is an edge-case that is not easily solvable. why are you entering fullscreen mode on an element?

@dirslashls
Copy link
Author

The application has a lot of UI and it allows users to focus on part of the UI by entering into fullscreen mode. Imagine a stock market application or a dashboard with lots of widgets but you want the user to be able to focus on a specific widget if they want to.

@dirslashls
Copy link
Author

FYI, locally I changed the

  while(p){

mentioned above to

var root = (document.fullscreenElement ?? document.webkitFullscreenElement ?? document.documentElement);
while (p !== root){

and it worked in normal and fullscreen modes.

@yairEO
Copy link
Owner

yairEO commented Aug 31, 2022

Good idea! I will incorporate that into the code and publish a new release later today

@yairEO yairEO changed the title Dropdown position is incorrect in fullscreen mode Dropdown position is incorrect when element enters fullscreen mode Aug 31, 2022
@yairEO yairEO closed this as completed in b019c41 Sep 1, 2022
@dirslashls
Copy link
Author

Thank you @yairEO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants