equalizedigital / accessibility-checker

GNU General Public License v2.0
14 stars 8 forks source link

Filter or setting to define base font size #657

Closed pattonwebz closed 2 months ago

pattonwebz commented 4 months ago

Is your feature request related to a problem? Please describe.

Some themes have larger base font sizes than the typical 16px which can throw the checks off for certain rules like possible headers or small font.

Describe the solution you'd like

A filter or setting to tell it what the base font size is to operate with.

Why do you think this feature is something we should consider for this plugin?

This will provide a useful way to reduce noise in certain themes or websites without affecting those that don't need it.

Additional context

SteveJonesDev commented 3 months ago

@pattonwebz. If we're pulling the computed font size in pixels, isn't the base font size already considered?

pattonwebz commented 3 months ago

@pattonwebz. If we're pulling the computed font size in pixels, isn't the base font size already considered?

It compares font size against exact pixel sizes. 20px is one number we check for possible header. If base font is 16px then 20 is 25% bigger. But if the base size is 18px then the difference to 20 is ~10% bigger only.

If someone has a base font of 20px then all the text will be flagged as possible heading.

I feel like we may want a calculation that is more like 'if the text is more than 20% larger' rather than 'is greater than 20px'.

SteveJonesDev commented 3 months ago

We'd be operating under the assumption it's okay to set the base font size to whatever you want. What if the base font size is set to 100 pixels? Do we not flag a possible heading until 120 pixels? The possible heading is to prevent visual confusion between elements. It may be less about the base font size and more about the element's font size in relation to the heading sizes on the page.

Interesting problem. We may need more input to come to a solution on this.

SteveJonesDev commented 2 months ago

Closing out issue. If we need to re-evaluate this a new issue can be opened internally.