preact icon indicating copy to clipboard operation
preact copied to clipboard

Fix option focus bug caused by IE11 option value workaround.

Open sznurek opened this issue 3 years ago • 3 comments

Whenever children of an

This hack breaks the behaviour of <select> element on other browsers: if you click on the dropdown, mouse over another option (but don't click) and rendering happens at this moment, the focus will go back to the current element. This is caused by setting the value attribute on

To resolve the issue, we save the value dom attribute before we place children and then check if it has changed afterwards, as a way to detect whether we need to activate the hack.

I'm not sure that this is the best solution to the problem - please let me know if you have a better one in mind!

Here's a link for reproducing the issue (at least on Firefox 86.0.1 on Windows 10). To reproduce, click on the dropdown, hover on any element other than the first one, wait for the callback to fire - you should see the focus moving to the first element.

sznurek avatar Mar 27 '21 14:03 sznurek

📊 Tachometer Benchmark Results

Summary

duration

  • 02_replace1k: unsure 🔍 -2% - +0% (-4.29ms - +0.78ms)
    preact-local vs preact-master
  • 03_update10th1k_x16: unsure 🔍 -5% - +4% (-1.91ms - +1.59ms)
    preact-local vs preact-master
  • 07_create10k: unsure 🔍 -1% - +1% (-11.37ms - +25.91ms)
    preact-local vs preact-master
  • filter_list: unsure 🔍 -2% - +2% (-0.67ms - +0.68ms)
    preact-local vs preact-master
  • hydrate1k: unsure 🔍 -2% - +0% (-3.54ms - +0.48ms)
    preact-local vs preact-master
  • many_updates: unsure 🔍 -7% - +3% (-2.97ms - +1.49ms)
    preact-local vs preact-master
  • text_update: unsure 🔍 -5% - +2% (-0.14ms - +0.06ms)
    preact-local vs preact-master

usedJSHeapSize

  • 02_replace1k: unsure 🔍 +0% - +0% (+0.00ms - +0.01ms)
    preact-local vs preact-master
  • 03_update10th1k_x16: unsure 🔍 -0% - +0% (-0.01ms - +0.01ms)
    preact-local vs preact-master
  • 07_create10k: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-master
  • filter_list: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-master
  • hydrate1k: unsure 🔍 -0% - +1% (-0.01ms - +0.04ms)
    preact-local vs preact-master
  • many_updates: unsure 🔍 +0% - +0% (+0.00ms - +0.00ms)
    preact-local vs preact-master
  • text_update: unsure 🔍 +0% - +0% (+0.00ms - +0.00ms)
    preact-local vs preact-master

Results

02_replace1k
  • Browser: chrome-headless 89.0.4389.90
  • Sample size: 80
  • Built by: Benchmarks #161
  • Commit: 512bbfd

duration

VersionAvg timevs preact-mastervs preact-local
preact-master174.10ms - 178.05ms-unsure 🔍
-0% - +2%
-0.78ms - +4.29ms
preact-local172.73ms - 175.92msunsure 🔍
-2% - +0%
-4.29ms - +0.78ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-local
preact-master3.57ms - 3.57ms-unsure 🔍
-0% - -0%
-0.01ms - -0.00ms
preact-local3.57ms - 3.58msunsure 🔍
+0% - +0%
+0.00ms - +0.01ms
-

run-warmup-0

VersionAvg timevs preact-mastervs preact-local
preact-master65.66ms - 66.80ms-unsure 🔍
-1% - +1%
-0.96ms - +0.66ms
preact-local65.81ms - 66.96msunsure 🔍
-1% - +1%
-0.66ms - +0.96ms
-

run-warmup-1

VersionAvg timevs preact-mastervs preact-local
preact-master102.04ms - 103.78ms-unsure 🔍
-1% - +1%
-1.12ms - +1.30ms
preact-local101.98ms - 103.66msunsure 🔍
-1% - +1%
-1.30ms - +1.12ms
-

run-warmup-2

VersionAvg timevs preact-mastervs preact-local
preact-master103.87ms - 112.40ms-faster ✔
1% - 10%
0.49ms - 11.31ms
preact-local110.70ms - 117.37msslower ❌
0% - 11%
0.49ms - 11.31ms
-

run-warmup-3

VersionAvg timevs preact-mastervs preact-local
preact-master67.86ms - 74.49ms-unsure 🔍
-3% - +9%
-1.69ms - +6.46ms
preact-local66.43ms - 71.15msunsure 🔍
-9% - +2%
-6.46ms - +1.69ms
-

run-warmup-4

VersionAvg timevs preact-mastervs preact-local
preact-master107.00ms - 113.36ms-unsure 🔍
-5% - +3%
-5.40ms - +3.65ms
preact-local107.84ms - 114.27msunsure 🔍
-3% - +5%
-3.65ms - +5.40ms
-

run-final

VersionAvg timevs preact-mastervs preact-local
preact-master64.78ms - 67.56ms-slower ❌
1% - 6%
0.42ms - 3.81ms
preact-local63.08ms - 65.02msfaster ✔
1% - 6%
0.42ms - 3.81ms
-
03_update10th1k_x16
  • Browser: chrome-headless 89.0.4389.90
  • Sample size: 60
  • Built by: Benchmarks #161
  • Commit: 512bbfd

duration

VersionAvg timevs preact-mastervs preact-local
preact-master39.39ms - 41.83ms-unsure 🔍
-4% - +5%
-1.59ms - +1.91ms
preact-local39.19ms - 41.71msunsure 🔍
-5% - +4%
-1.91ms - +1.59ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-local
preact-master3.65ms - 3.66ms-unsure 🔍
-0% - +0%
-0.01ms - +0.01ms
preact-local3.65ms - 3.66msunsure 🔍
-0% - +0%
-0.01ms - +0.01ms
-
07_create10k
  • Browser: chrome-headless 89.0.4389.90
  • Sample size: 50
  • Built by: Benchmarks #161
  • Commit: 512bbfd

duration

VersionAvg timevs preact-mastervs preact-local
preact-master1828.95ms - 1851.86ms-unsure 🔍
-1% - +1%
-25.91ms - +11.37ms
preact-local1832.98ms - 1862.37msunsure 🔍
-1% - +1%
-11.37ms - +25.91ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-local
preact-master25.97ms - 25.97ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
preact-local25.97ms - 25.97msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-
filter_list
  • Browser: chrome-headless 89.0.4389.90
  • Sample size: 50
  • Built by: Benchmarks #161
  • Commit: 512bbfd

duration

VersionAvg timevs preact-mastervs preact-local
preact-master28.88ms - 29.90ms-unsure 🔍
-2% - +2%
-0.68ms - +0.67ms
preact-local28.96ms - 29.83msunsure 🔍
-2% - +2%
-0.67ms - +0.68ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-local
preact-master1.58ms - 1.59ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
preact-local1.58ms - 1.59msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-
hydrate1k
  • Browser: chrome-headless 89.0.4389.90
  • Sample size: 50
  • Built by: Benchmarks #161
  • Commit: 512bbfd

duration

VersionAvg timevs preact-mastervs preact-local
preact-master183.35ms - 186.44ms-unsure 🔍
-0% - +2%
-0.48ms - +3.54ms
preact-local182.07ms - 184.65msunsure 🔍
-2% - +0%
-3.54ms - +0.48ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-local
preact-master6.17ms - 6.19ms-unsure 🔍
-1% - +0%
-0.04ms - +0.01ms
preact-local6.17ms - 6.21msunsure 🔍
-0% - +1%
-0.01ms - +0.04ms
-
many_updates
  • Browser: chrome-headless 89.0.4389.90
  • Sample size: 70
  • Built by: Benchmarks #161
  • Commit: 512bbfd

duration

VersionAvg timevs preact-mastervs preact-local
preact-master41.15ms - 44.37ms-unsure 🔍
-4% - +7%
-1.49ms - +2.97ms
preact-local40.48ms - 43.56msunsure 🔍
-7% - +3%
-2.97ms - +1.49ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-local
preact-master4.83ms - 4.83ms-unsure 🔍
-0% - -0%
-0.00ms - -0.00ms
preact-local4.83ms - 4.83msunsure 🔍
+0% - +0%
+0.00ms - +0.00ms
-
text_update
  • Browser: chrome-headless 89.0.4389.90
  • Sample size: 100
  • Built by: Benchmarks #161
  • Commit: 512bbfd

duration

VersionAvg timevs preact-mastervs preact-local
preact-master2.91ms - 3.05ms-unsure 🔍
-2% - +5%
-0.06ms - +0.14ms
preact-local2.87ms - 3.01msunsure 🔍
-5% - +2%
-0.14ms - +0.06ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-local
preact-master0.98ms - 0.98ms-unsure 🔍
-0% - -0%
-0.00ms - -0.00ms
preact-local0.98ms - 0.98msunsure 🔍
+0% - +0%
+0.00ms - +0.00ms
-

tachometer-reporter-action v2 for Benchmarks

github-actions[bot] avatar Mar 27 '21 14:03 github-actions[bot]

Coverage Status

Coverage remained the same at 99.445% when pulling 512bbfd5a540ec302027b1b5727505d9309d9a2f on sznurek:master into c7f57db13af43b8cc3353a138639ad9dd9523e16 on preactjs:master.

coveralls avatar Mar 27 '21 14:03 coveralls

Is there anything else I should do before this pull request is reviewed?

sznurek avatar Jun 17 '21 12:06 sznurek