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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu is offset incorrectly #802

Open
Pytal opened this issue May 26, 2022 · 0 comments
Open

Menu is offset incorrectly #802

Pytal opened this issue May 26, 2022 · 0 comments

Comments

@Pytal
Copy link

Pytal commented May 26, 2022

How can we reproduce this bug?

  1. On a Nextcloud instance open the Files or Photos app
  2. Choose a file
  3. Open a sidebar
  4. Go to comments-tab
  5. Reduce viewport width to around <1100px
  6. Type @ in input field to search for available users
  7. See that the dropdown menu is on a left side and is not visible for user

What did you expect to happen?

Menu is fully visible

What happened instead?

Before reducing the width

image

After reducing the width the menu is offset to the left

image

Cause

This appears to be caused by the positioning code

tribute/src/TributeRange.js

Lines 527 to 573 in 252ec34

getFixedCoordinatesRelativeToRect(rect) {
let coordinates = {
position: 'fixed',
left: rect.left,
top: rect.top + rect.height
}
let menuDimensions = this.getMenuDimensions()
var availableSpaceOnTop = rect.top;
var availableSpaceOnBottom = window.innerHeight - (rect.top + rect.height);
//check to see where's the right place to put the menu vertically
if (availableSpaceOnBottom < menuDimensions.height) {
if (availableSpaceOnTop >= menuDimensions.height || availableSpaceOnTop > availableSpaceOnBottom) {
coordinates.top = 'auto';
coordinates.bottom = window.innerHeight - rect.top;
if (availableSpaceOnBottom < menuDimensions.height) {
coordinates.maxHeight = availableSpaceOnTop;
}
} else {
if (availableSpaceOnTop < menuDimensions.height) {
coordinates.maxHeight = availableSpaceOnBottom;
}
}
}
var availableSpaceOnLeft = rect.left;
var availableSpaceOnRight = window.innerWidth - rect.left;
//check to see where's the right place to put the menu horizontally
if (availableSpaceOnRight < menuDimensions.width) {
if (availableSpaceOnLeft >= menuDimensions.width || availableSpaceOnLeft > availableSpaceOnRight) {
coordinates.left = 'auto';
coordinates.right = window.innerWidth - rect.left;
if (availableSpaceOnRight < menuDimensions.width) {
coordinates.maxWidth = availableSpaceOnLeft;
}
} else {
if (availableSpaceOnLeft < menuDimensions.width) {
coordinates.maxWidth = availableSpaceOnRight;
}
}
}
return coordinates
}

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

No branches or pull requests

1 participant