织梦CMS - 轻松建站从此开始!

欧博ABG官网-欧博官方网址-会员登入

欧博娱乐Why does tabIndex not work after first tab to

时间:2026-01-13 02:12来源: 作者:admin 点击: 0 次
You can view my app here: https://moon.holdings Here is the repo: https://github.com/Futuratum/moon.holdings If you select the [ + ] Add Asset but

You can view my app here: https://moon.holdings

Here is the repo: https://github.com/Futuratum/moon.holdings

If you select the [ + ] Add Asset button, click in the search input and hit tab there are 2 issues.

Nothing is selected the first time, you have to tab again in order to select the first asset.

And more importantly after Bitcoin is selected, tabbing does not select the next item in the list. Instead after 4 tabs the I can see that the Coinbase button was selected instead of another li.

Here you can see that each li does correctly have a tabindex:

enter image description here

enter image description here

1st tab, nothing selected

2nd tab, Bitcoin selected

3rd tab, nothing selected

4th tab, Coinbase button selected:

enter image description here

The JSX of the searchModal.js component:

render() { const { assets } = this.state; return ( <section> <header className="search-header"> <input type="text" placeholder="Search" onChange={() => this.handleChange()} /> <button className="close-modal-x" onClick={this.closeSquareEdit} /> </header> <ul> { assets !== 'undefined' ? assets.map((asset, i) => ( <li key={asset.currency} role="button" tabIndex={i} onFocus={() => this.setFocus(asset)} onBlur={this.onBlur} onClick={() => this.handleSelect(asset)} > {asset.name} <span className="symbol">{asset.currency}</span> </li>)) : <li>Loading...</li> } </ul> </section> ); }

The main container: Board.js

return ( <div> { this.renderPortfolio(sortedAssets) } { edit && this.renderSquareEdit(coin) } { search && this.renderSearchModal() } { loading && moonPortfolio && <Loading /> } { portfolio.length === 0 && <Welcome /> } <PlusButton toggleSearch={this.handleSearchButton} /> <Affiliates /> <Nomics /> <Astronaut logo={isTrue} /> </div> );

The renderSearch method:

renderSearchModal() { return ( <div> <Search handleClose={() => this.toggleSquareEdit(false, {})} openEdit={this.toggleSquareEdit} /> <div onClick={this.handleSearchButton} /> </div> ); }

Finally the affiliates.js component

const links = [ { name: 'coinbase', link: coinbase, h4: 'Buy Bitcoin' }, { name: 'binance', link: binance, h4: 'Buy Altcoins' }, { name: 'changelly', link: changelly, h4: 'Swap coins' } ]; export default () => ( <div className="affiliates"> <ul> {links.map(l => ( <a href={l.link} key={l.name}> <li className={l.name}> <h4>{l.h4}</h4> </li> </a> ))} </ul> </div> );

(责任编辑:)
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:
发布者资料
查看详细资料 发送留言 加为好友 用户等级: 注册时间:2026-01-13 07:01 最后登录:2026-01-13 07:01
栏目列表
推荐内容