Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat(vwc-popup): change anchorEl to anchorId #1214
feat(vwc-popup): change anchorEl to anchorId #1214
Changes from 10 commits
23b1a09
09b04b9
b5d2b8e
9ad5ead
cbb8017
b70d341
55bc1c9
91ed13c
4d364d0
a70b893
f99f492
7322fa8
ee679db
fde1fe7
c79dba1
7b899b3
38d55e5
7fb8058
6279bb9
16ee7ec
69b64e5
e3c985a
611acc2
efcc8fa
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Now I see why you have this delay.
It should be documented in the tests:
it("should delay first position by 300ms")
Or something like that. How did you get to 300ms BTW?
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.
@YonatanKra Having to set timeout, I chose 300 milliseconds because I saw FAST had a 300 millisecond delay for their tooltip to appear.
Would you suggest a time of less than 300 milliseconds?
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.
As I said, we can go with 300ms, it just needs to be documented (in tests) as suggested. Why not 100ms (which is the maximum time for user interaction response)? Would it work then?
I guess 300ms is a heuristic because other factors might delay the page layout calculation (like long running JS or longer running calculations before the component loaded).
So 100ms will not be enough.
By the way, we'd might want to add our own "ready" promise on this component and then use it in the tests. This might be a handy API.
I just don't feel good enough with arbitrary numbers going around.
In either case (arbitrary or not), we need to document this in the tests as this is part of the API exposed to the user (expect the component to finish rendering in 300ms).
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.
Thinking about it, I think we can "hide" this
setTimeout
behind anupdateComplete
message. Something like that in thefirstUpdated
function:I think that's the right syntax. Then the
updateComplete
will reflect the 300ms wait.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.
This way, the
300ms
becomes an implementation details and not an unexpected side effect.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.
@YonatanKra updateComplete is read-only
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.
Correct me if i'm wrong @rinaok but the denounce is required for document to be ready. The popup component has no way of knowing 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.
Will this be of any help?
https://toruskit.com/blog/how-to-get-element-bounds-without-reflow/
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.
I did something with:
_getUpdateComplete
. Might help but seems an overkill.If 300ms is a must then we need to document it in the tests (e.g.
should run positionUpdate on load after 300ms delay
).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.
@rinaok if the intersection observer solves it, we may wanna create a single intersectionObserver instance and reuse it.
notice it is being used as a service here
https://github.com/microsoft/fast/blob/master/packages/web-components/fast-foundation/src/utilities/intersection-service.ts
we can actually might as well use that service 🤔