Skip to content

Commit a7686be

Browse files
committed
COD-1944
Lightbox: nest thumbnail img inside button, add aria label to button, add onKeyPress to button, fix padding
1 parent b7ef5fa commit a7686be

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/react-image-lightbox.js

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,25 +1633,38 @@ class ReactImageLightbox extends Component {
16331633
/>
16341634
))}
16351635
{this.props.thumbnailImages.map((img, index) => (
1636-
<img
1637-
className={`thumbNails${
1638-
imageIndex === index + 1 ? 'active' : ''
1639-
}`}
1636+
<button
16401637
style={{
16411638
margin: '14px',
1642-
padding: '2px',
1639+
paddingTop: '3px',
1640+
paddingRight: '3px',
1641+
paddingBottom: '0px',
1642+
paddingLeft: '3px',
16431643
borderRadius: '4px',
16441644
}}
1645-
src={img}
1646-
key={img}
1647-
role="presentation"
1648-
alt={img.caption}
1645+
type="button"
1646+
aria-label="view fullsize image for this thumbnail"
1647+
className={`thumbNails${
1648+
imageIndex === index + 1 ? 'active' : ''
1649+
}`}
16491650
onClick={() => {
16501651
return !this.isAnimating()
16511652
? this.requestMoveIndex({ index })
16521653
: undefined;
16531654
}}
1654-
/>
1655+
onKeyPress={() => {
1656+
return !this.isAnimating()
1657+
? this.requestMoveIndex({ index })
1658+
: undefined;
1659+
}}
1660+
>
1661+
<img
1662+
src={img}
1663+
key={img}
1664+
role="presentation"
1665+
alt={img.caption}
1666+
/>
1667+
</button>
16551668
))}
16561669

16571670
{nextSrc &&

0 commit comments

Comments
 (0)