Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Align message context menu to right
Browse files Browse the repository at this point in the history
This changes the message context menu to align the right edge of the menu with
the right edge of the button that opens it, which should keep all menu options
inside the viewport, even if they are very wide.

Part of element-hq/element-web#9624
  • Loading branch information
jryans committed Jun 10, 2019
1 parent 3126880 commit 0355c91
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/views/messages/MessageActionBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default class MessageActionBar extends React.PureComponent {

// The window X and Y offsets are to adjust position when zoomed in to page
const x = buttonRect.right + window.pageXOffset;
const y = (buttonRect.top + (buttonRect.height / 2) + window.pageYOffset) - 19;
const y = buttonRect.bottom + window.pageYOffset;

const { getTile, getReplyThread } = this.props;
const tile = getTile && getTile();
Expand All @@ -83,9 +83,10 @@ export default class MessageActionBar extends React.PureComponent {
}

createMenu(MessageContextMenu, {
chevronOffset: 10,
mxEvent: this.props.mxEvent,
left: x,
chevronFace: "none",
// Align the right edge of the menu to the right edge of the button
right: window.innerWidth - x,
top: y,
permalinkCreator: this.props.permalinkCreator,
eventTileOps: tile && tile.getEventTileOps ? tile.getEventTileOps() : undefined,
Expand Down

0 comments on commit 0355c91

Please sign in to comment.