Open
Description
The accessible autocomplete does not seem to play very nicely with Content Security Policy (CSP), specifically the style-src
directive:
- On iOS browsers, it sets
style
attributes on elements, which is blocked by thestyle-src
directive unless'unsafe-inline'
is specified - It uses the
cssText
setter as part of a function to detect support for pointer events, which is blocked by thestyle-src
directive unless'unsafe-eval'
is specified (curiously, only some browsers seem to report CSP violations for this)
Therefore, using the accessible autocomplete on pages protected by CSP only works if one allows 'unsafe-inline'
and 'unsafe-eval'
as style sources, which reduces the protection offered by CSP.
This was discovered when trying to apply CSP to GOV.UK Pay’s enter card details page, which uses the GOV.UK country and territory autocomplete, which is built on the accessible autocomplete component.