-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Handle null parentElement for selection anchor #18884
Conversation
/botio-linux preview |
From: Bot.io (Linux m4)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://54.241.84.105:8877/a1ada5b8ae11d90/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/a1ada5b8ae11d90/output.txt Total script time: 1.01 mins Published |
/botio integrationtest |
From: Bot.io (Linux m4)ReceivedCommand cmd_integrationtest from @timvandermeij received. Current queue size: 0 Live output at: http://54.241.84.105:8877/297883ec4e536b7/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_integrationtest from @timvandermeij received. Current queue size: 0 Live output at: http://54.193.163.58:8877/22a3fb8e708c06e/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/297883ec4e536b7/output.txt Total script time: 9.21 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.193.163.58:8877/22a3fb8e708c06e/output.txt Total script time: 20.43 mins
|
Thank you for your contribution! |
In the
selectionchange
handler that's added to the document byTextLayerBuilder
, there is a line which accessesanchor.parentElement.closest(".textLayer")
.This throws an error if
anchor.parentElement
is null, which can happen if the selection is inside a shadow root - I can reproduce it by selecting text inside Grammarly's popover on a page where PDF.is is being used.The error is only seen in non-Firefox browsers, as there is a line which returns earlier in Firefox.
This change handles the
null
parentElement gracefully, to avoid throwing the error.