spectrum-web-components icon indicating copy to clipboard operation
spectrum-web-components copied to clipboard

fix(menu): patch undefined lastFocusedItem

Open castastrophe opened this issue 3 years ago • 2 comments
trafficstars

Description

Patch an error where lastFocusedItem might be undefined when the .hasSubmenu if statement is run.

Related issue(s)

  • #2525

Motivation and context

Should include a check that the lastFocusedItem was found before checking it for the hasSubmenu property. @Westbrook do you want to include some kind of warning or error if the lastFocusedItem is undefined?

How has this been tested?

// todo

  • [ ] Test case 1
    1. Go here
    2. Do this

Types of changes

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Chore (minor updates related to the tooling or maintenance of the repository, does not impact compiled assets)

Checklist

  • [x] I have signed the Adobe Open Source CLA.
  • [x] My code follows the code style of this project.
  • [x] If my change required a change to the documentation, I have updated the documentation in this pull request.
  • [x] I have read the CONTRIBUTING document.
  • [ ] I have added tests to cover my changes.
  • x ] All new and existing tests passed.
  • x ] I have reviewed at the Accessibility Practices for this feature, see: Aria Practices

Best practices

This repository uses conventional commit syntax for each commit message; note that the GitHub UI does not use this by default so be cautious when accepting suggested changes. Avoid the "Update branch" button on the pull request and opt instead for rebasing your branch against main.

castastrophe avatar Sep 14 '22 20:09 castastrophe

Tachometer results

Chrome

action-menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 628 kB 185.73ms - 189.07ms - unsure 🔍
-1% - +1%
-1.54ms - +2.45ms
branch 642 kB 185.84ms - 188.04ms unsure 🔍
-1% - +1%
-2.45ms - +1.54ms
-

menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 310 kB 213.75ms - 217.13ms - unsure 🔍
-0% - +2%
-0.48ms - +3.99ms
branch 323 kB 212.23ms - 215.14ms unsure 🔍
-2% - +0%
-3.99ms - +0.48ms
-

picker permalink

Version Bytes Avg Time vs remote vs branch
npm latest 461 kB 642.33ms - 648.25ms - unsure 🔍
-1% - +0%
-7.88ms - +1.42ms
branch 474 kB 644.93ms - 652.11ms unsure 🔍
-0% - +1%
-1.42ms - +7.88ms
-

split-button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 560 kB 2025.71ms - 2028.00ms - unsure 🔍
-0% - +0%
-3.30ms - +0.45ms
branch 574 kB 2026.80ms - 2029.76ms unsure 🔍
-0% - +0%
-0.45ms - +3.30ms
-
Firefox

action-menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 628 kB 600.36ms - 614.20ms - unsure 🔍
-2% - +1%
-11.55ms - +8.15ms
branch 642 kB 601.97ms - 615.99ms unsure 🔍
-1% - +2%
-8.15ms - +11.55ms
-

menu permalink

Version Bytes Avg Time vs remote vs branch
npm latest 310 kB 750.71ms - 764.09ms - unsure 🔍
-3% - +0%
-20.05ms - +3.49ms
branch 323 kB 756.00ms - 775.36ms unsure 🔍
-0% - +3%
-3.49ms - +20.05ms
-

picker permalink

Version Bytes Avg Time vs remote vs branch
npm latest 461 kB 1760.09ms - 1786.95ms - unsure 🔍
-2% - +0%
-32.09ms - +5.57ms
branch 474 kB 1773.58ms - 1799.98ms unsure 🔍
-0% - +2%
-5.57ms - +32.09ms
-

split-button permalink

Version Bytes Avg Time vs remote vs branch
npm latest 560 kB 2228.61ms - 2250.03ms - unsure 🔍
-1% - +0%
-25.36ms - +8.72ms
branch 574 kB 2234.39ms - 2260.89ms unsure 🔍
-0% - +1%
-8.72ms - +25.36ms
-

github-actions[bot] avatar Sep 14 '22 20:09 github-actions[bot]