-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Use textarea-caret to place compose box typeahead near the cursor #30141
base: main
Are you sure you want to change the base?
Conversation
@amanagr can you review this PR since you implemented tippy for typeaheads? |
web/src/bootstrap_typeahead.ts
Outdated
if (placement === "bottom-start") { | ||
const field_height = input_element.$element.height(); | ||
assert(field_height, "Text area height property missing"); | ||
const distance = field_height - caret.top - 8; | ||
return [caret.left, -distance]; | ||
} |
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.
Should we just move the typeahead that uses bottom-start
to use top-start
too and remove this logic?
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.
The caret co-ordinates are relative to top left corner of text area. In bottom-start
typeahead, the offset works from bottom left corner. Thus the height of reference (text-area) is used to calculate the offset from top left corner.
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.
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.
Oh yeah! Makes sense to have this case anyway then. I think my only desired tweak would be use a variable for 4 here to better represent what this stands for. Otherwise, LGTM.
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.
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.
Added a variable for it
@adnan-td thanks for working on this! Looks great! Left a comment. |
9ca1c9e
to
c21076f
Compare
LGTM @adnan-td can you resovle the conflicts and push agian? |
Done! Resolved the conflicts |
Excited to see this moving forward! |
Fixed this issue which occurred due to scrolling in the text area by adding |
Utilize textarea-caret package to offset the typeahead position. Now typeahead is close to the cursor. Fixes: zulip#29974
@amanagr Any additional feedback before this goes to integration review? I haven't re-tested. |
Looks good to me as well. Tested this is working well for compose box and message edit box. |
Add textarea-caret package to position the typeahead close to the cursor in the textarea.
Fixes: #29974
Screenshots:
Compose box text area -
In smaller screenwidths:
Self-review checklist
(variable names, code reuse, readability, etc.).
Communicate decisions, questions, and potential concerns.
Individual commits are ready for review (see commit discipline).
Completed manual review and testing of the following: