-
Notifications
You must be signed in to change notification settings - Fork 957
Fix DrawingArea sending messages with an empty id #14009
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
base: main
Are you sure you want to change the base?
Fix DrawingArea sending messages with an empty id #14009
Conversation
b3af965 to
71a5e47
Compare
|
Possibly it something which fixes similar problem to: #12484 |
71a5e47 to
540b6e3
Compare
|
This reminded me to update the code to include all references to callback, I believe my current implementation ends up creating a chain of elements to find the most recent which is a bit messy, we could directly find the most recent by searching for the id? |
540b6e3 to
f19f478
Compare
|
I feel like finding the element by the id is a simpler solution, also I think that [ #12484 ] solves the same issue. Replacing the id of the deleted element should also work; we set the id to "" so that the new replacement element can take the old id, but it is then removed from the DOM, so setting the id back to the old id after removing is fine. Basically I think either would work. |
5f25e13 to
68bfe0c
Compare
be careful with id, we have MakeIdUnique function which appends some random numbers, we shouldn't have multiple nodes with the same id in the DOM for a11y compatibility. let me check the patch |
|
|
||
| container.getCurrent = function () { | ||
| if (container.id == "") { | ||
| return document.getElementById(data.id); |
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.
best to not query whole document, but the minimum required -> for example parentContainer
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 isn't a clean way to do this; the element has been removed from the DOM (which is the entire problem), so no longer has a parent in the case that the id == "", and when the containing function is ran is the child of a document fragment, so the parent is also useless. It is possible f=by storing the parent after the element is removed:
https://github.com/celestial-starfruit/online/tree/private/maya/push-wwxovxkzppnp
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.
isn't the object under ref: parentContainer still valid? is that detached too?
I guess it migth be scroll window in the .ui in core which is replaced.
In that case - yes we can query the DOM to be safe.
|
@celestial-starfruit code looks ok, but possibly the problem here is with update approach. Where we execute action in online:
How to send action in core:
|
|
That would avoid a lot of annoying work arounds. Even with these commits, there is flickering on (which I only got on firefox) (fixed with celestial-starfruit@45691d4) due to the new dataurl not being parsed yet but the old element being removed (also changing the dialog size cause the unloaded image has size 0), the workaround isn't great so I'll look into only updating the image url! |
|
Flickering is fixed by https://github.com/celestial-starfruit/online/tree/private/maya/push-wnytxnqpxpkz, but kinda nasty code. firefox_flicker.mp4chrome_no_flicker.mp4 |
| ret[1] = e.changedTouches[e.changedTouches.length-1].pageY - $(imageElement).offset().top; | ||
| } | ||
| var boundingBox = imageElement.getBoundingClientRect(); | ||
| var ret = [e.x - boundingBox.left, e.y - boundingBox.top]; |
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.
did we check with touch device (real not simulated) too?
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.
Nope, really good point! Not sure how to test that at the moment
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.
@Minion3665 could you help?
eszkadev
left a comment
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.
code looks good in my opinion - improves a bit the state. If during testing will be ok,
we can merge and do the even better approach as a followup as it requires more time
68bfe0c to
c93ca8d
Compare
When the drawing area is used, it is updated to use a new photo from the server; this replaces the old element, setting the ID to the empty string in the process. The next time it tries to send a message to the server, the message has an empty id, triggering an assert on the browser and crashing the server. Signed-off-by: Maya Stephens <[email protected]> Change-Id: Ia32fbadc730c83f2a89da38287a2c4406a6a6964
The previous method of calculating drawing area position had issues if the mouse went above a different element. Signed-off-by: Maya Stephens <[email protected]> Change-Id: Ia32fbadc730c83f2a89da38287a2c4406a6a6964
c93ca8d to
c13990c
Compare
Summary
TODO
Checklist
make prettier-writeand formatted the code.make checkmake runand manually verified that everything looks okay