ampproject / ampproject/amphtml
<amp-autocomplete> Validator sometimes throws error even though it's the same html code and valid amp-autocomplete
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
## What's the issue?
fires error on page load when it shouldn't
Uncaught (in promise) Resource: failed to build: amp-autocomplete#20: amp-autocomplete should contain exactly one or descendant amp-autocomplete
## How do we reproduce the issue?
1. Go to https://cartia.ro/carti/pentru-Tineri_intre_13_si_18_ani
2. Look at console, sometimes it works with now errors, but on some refreshes, it throws the error
3. the input is always present in <amp-autocomplete>
## What browsers are affected?
Tested on Chrome Version 87.0.4280.88 (Official Build) (x86_64)
## Which AMP version is affected?
Powered by AMP ⚡ HTML – Version 2011252111002 https://cartia.ro/carti/pentru-Tineri_intre_13_si_18_ani
We are transitioning to AMP framework but we do it progressive, so there are still some amp errors, we tried this with no other JS besides AMP and it's still reproducible.
I looked into the amp-autocomplete code and the only thing that may happen is maybe the DOM is not fully initialized yet when amp-autocomplete runs the querySelectorAll() or since the method returns a static (not live) list, it may not be "ready" yet?
Contributor guide
Research direction
Start by reproducing the issue on the provided cartia.ro page, then inspect the amp-autocomplete validation path around querySelectorAll(). Done means valid markup consistently loads without the erroneous descendant-count error across refreshes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100