fix: fix tabPanel scrollTop bug (#180)

This commit is contained in:
Nolan Lawson 2021-07-11 15:38:01 -07:00 committed by GitHub
parent c0619d538e
commit 05548210a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -313,9 +313,11 @@ $: {
requestAnimationFrame(() => checkZwjSupportAndUpdate(zwjEmojisToCheck))
} else {
currentEmojis = currentEmojis.filter(isZwjSupported)
requestAnimationFrame(() => { // reset scroll top to 0 when emojis change
if (tabpanelElement) { // can be null if element is disconnected immediately after connected
requestAnimationFrame(() => { // reset scroll top to 0 when emojis change]
try {
tabpanelElement.scrollTop = 0
} catch (e) {
// tabpanelElement can be null if element is disconnected immediately after connected. ignore
}
})
}