Commit 0a21f55f by Ari Rizzitano

patch dropdown for bootstrap v4

parent bdde7afe
...@@ -3,3 +3,15 @@ ...@@ -3,3 +3,15 @@
.btn-borderless { .btn-borderless {
border: 0 !important; border: 0 !important;
} }
// Trying to patch this upstream, then this can
// be removed.
// https://github.com/twbs/bootstrap/pull/23990
.show {
> a:focus {
outline-width: 2px;
outline-style: solid;
outline-color: Highlight;
outline: -webkit-focus-ring-color auto 5px;
}
}
...@@ -98,19 +98,18 @@ class Dropdown extends React.Component { ...@@ -98,19 +98,18 @@ class Dropdown extends React.Component {
generateMenuItems(menuItems) { generateMenuItems(menuItems) {
return menuItems.map((menuItem, i) => ( return menuItems.map((menuItem, i) => (
<li className={styles['dropdown-item']} key={i}> <a
<a className={styles['dropdown-item']}
role="menuitem" href={menuItem.href}
href={menuItem.href} key={i}
onKeyDown={this.handleMenuKeyDown} onKeyDown={this.handleMenuKeyDown}
ref={(item) => { ref={(item) => {
this.menuItems[i] = item; this.menuItems[i] = item;
}} }}
tabIndex="-1" role="menuitem"
> >
{menuItem.label} {menuItem.label}
</a> </a>
</li>
)); ));
} }
...@@ -138,14 +137,17 @@ class Dropdown extends React.Component { ...@@ -138,14 +137,17 @@ class Dropdown extends React.Component {
type="button" type="button"
inputRef={(toggleElem) => { this.toggleElem = toggleElem; }} inputRef={(toggleElem) => { this.toggleElem = toggleElem; }}
/> />
<ul <div
aria-label={this.props.title} aria-label={this.props.title}
aria-hidden={!this.state.open} aria-hidden={!this.state.open}
className={styles['dropdown-menu']} className={classNames([
styles['dropdown-menu'],
{ [styles.show]: this.state.open },
])}
role="menu" role="menu"
> >
{menuItems} {menuItems}
</ul> </div>
</div> </div>
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment