-
-
Notifications
You must be signed in to change notification settings - Fork 130
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
Add horizontalAlignment
to Menu.open()
options
#732
Conversation
Thank you @andrewfulton9!
Maybe we could use a regular expression pattern here, optionally allowing the number to have more decimal digits? |
@krassowski, I updated the tests so only the whole number of the x value is checked. It should be good to go now! |
packages/widgets/src/menu.ts
Outdated
* | ||
* The default is `'left'` unless the document `dir` attribute is `'rtl'` | ||
*/ | ||
align?: 'left' | 'right'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make this more future-proof, should we call it horizontalAlignment
instead? So that we can add verticalAlignment
if we need it later?
Otherwise it looks great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! I just updated that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @andrewfulton9!
Closes #709
Adds an "align" option to Menu.IOpenOptions that can be set to "left" or "right" and adjusts the menu position so the top left or right corner is matched to the given x and y coordinates based on the given align value. It defaults to left or right depending on the document
dir
attribute to account for the given language direction.