springload / react-accessible-headings

Makes it easier to keep heading levels semantic and accessible (WCAG)

Home Page:https://www.npmjs.com/package/react-accessible-headings

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: configurable default className attribute on h* tags

Flammae opened this issue · comments

commented

The problem with not knowing which heading tag the <H> element will render is that it makes elements unselectable from CSS.

consider this mark up:

<Level>
    <div className="container">
        <H>What tag is this?</H>
    </div>
</Level>
.container > h{?} {
    margin-top: 100;
}

sure you could define className on h tag and select it from css, but sometimes it's undesirable to make up names for every single h tag in a component. Doing something like .container > *:nth-child(n) is not practical for obvious reasons.

My offer is to have a default className on every h tag, which can be configured with a prop to <Level /> component (nested Levels inherit the className, unless overwritten).

I'd love to work on this over the weekend, but first I need to make sure I'm not being dumb and there's not some obvious thing I'm missing. Also, I've never Pr-d a public repo, but this one seems easy enough to figure out

ok so a default className of just "h"? Sounds good.

I'll wait on your PR

commented

Hey!

So, this (#4) is what I've managed to do. Please let me know if I should change anything

@beqaMeqvabishvili Thanks! I'll review over the next week

Resolved in #7 #6 #5 etc