feat: tab switch for languages

This commit is contained in:
Pragadesh-45 2024-10-15 14:16:51 +05:30
parent a0fcb6c91f
commit b900d3070d

View File

@ -59,7 +59,16 @@ const GenerateCodeItem = ({ collection, item, onClose }) => {
className={
language.name === selectedLanguage.name ? 'generate-code-item active' : 'generate-code-item'
}
role="button"
tabIndex={0}
onClick={() => setSelectedLanguage(language)}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
setSelectedLanguage(language);
e.preventDefault();
}
}}
aria-pressed={language.name === selectedLanguage.name}
>
<span className="capitalize">{language.name}</span>
</div>