Skip to content

Commit c2c729a

Browse files
Merge pull request #127 from bitlogic/fix/SBIT-604-social-icons-accessibility
SBIT-604 botón de twitter enlace sin texto de anclaje
2 parents 1d74d32 + 32d4286 commit c2c729a

File tree

4 files changed

+38
-23
lines changed

4 files changed

+38
-23
lines changed

src/components/FaIcon/FaIcon.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,26 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
33
import { faEnvelope, faLocationDot } from "@fortawesome/free-solid-svg-icons"
44
import {
55
faLinkedin,
6-
faTwitter,
7-
faXTwitter,
86
faInstagram,
97
faYoutube,
10-
faSpotify
11-
8+
faSpotify,
9+
faXTwitter,
1210
} from "@fortawesome/free-brands-svg-icons"
1311
import PropTypes from "prop-types"
1412

1513
const iconMap = {
1614
"fa-envelope": faEnvelope,
1715
"fa-location-dot": faLocationDot,
1816
"fa-linkedin": faLinkedin,
19-
"fa-twitter": faTwitter,
2017
"fa-x-twitter": faXTwitter,
2118
"fa-instagram": faInstagram,
2219
"fa-youtube": faYoutube,
2320
"fa-spotify": faSpotify,
2421
}
2522

2623
const FaIcon = ({ type, code }) => {
27-
const icon = iconMap[code]
24+
const normalizedCode = code?.toLowerCase()
25+
const icon = iconMap[normalizedCode]
2826

2927
if (!icon) {
3028
console.warn(`Icono no encontrado: type=${type}, code=${code}`)
@@ -39,6 +37,4 @@ FaIcon.propTypes = {
3937
code: PropTypes.string.isRequired,
4038
}
4139

42-
4340
export default FaIcon
44-

src/components/Footer/SocialLinks/socialLinks.js

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,21 @@ import PropTypes from "prop-types"
88
export default function SocialLinks({ image, socialMedia }) {
99
const logo = getImage(image?.localFile?.childImageSharp?.gatsbyImageData)
1010

11-
const socialMediaItems = socialMedia?.map(item => {
12-
return (
13-
<a
14-
key={item.id}
15-
href={item.url}
16-
target="_blank"
17-
className={`btn-social m-2 btn-social-icon btn-${item.icon?.name}`}
18-
rel="noreferrer"
19-
aria-label={`Link externo a ${item?.name}`}
20-
>
11+
const socialMediaItems = socialMedia?.map(item => (
12+
<a
13+
key={item.id}
14+
href={item.url}
15+
target="_blank"
16+
className={`btn-social m-2 btn-social-icon btn-${item.icon?.name}`}
17+
rel="noreferrer"
18+
aria-label={`External link to ${item?.name}`}
19+
>
20+
<>
2121
<FaIcon type={item.icon?.type} code={item.icon?.code} />
22-
</a>
23-
)
24-
})
22+
<span className="visually-hidden">Link to {item.name}</span>
23+
</>
24+
</a>
25+
))
2526

2627
return (
2728
<div className="Footer__socialMedia d-flex flex-column">
@@ -33,10 +34,10 @@ export default function SocialLinks({ image, socialMedia }) {
3334

3435
{logo && (
3536
<div className="Footer__socialMedia__Logo text-center">
36-
<Link to="/">
37+
<Link to="/en">
3738
<GatsbyImage
3839
image={logo}
39-
alt={image?.alternativeText || "Logo Bitlogic"}
40+
alt={image?.alternativeText || "Bitlogic Logo"}
4041
/>
4142
</Link>
4243
</div>
@@ -60,6 +61,9 @@ SocialLinks.propTypes = {
6061
url: PropTypes.string,
6162
name: PropTypes.string,
6263
icon: PropTypes.shape({
64+
name: PropTypes.string,
65+
type: PropTypes.string,
66+
code: PropTypes.string,
6367
url: PropTypes.string,
6468
alternativeText: PropTypes.string,
6569
localFile: PropTypes.shape({

src/components/Footer/SocialLinks/socialLinks.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
color: $white;
1111
width: 21px;
1212
height: 21px;
13+
display: inline-flex;
14+
align-items: center;
15+
justify-content: center;
1316
}
1417
}
1518

src/styles/global.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,3 +268,15 @@ body {
268268
font-size: 3em;
269269
}
270270
}
271+
272+
.visually-hidden {
273+
position: absolute !important;
274+
width: 1px !important;
275+
height: 1px !important;
276+
padding: 0 !important;
277+
margin: -1px !important;
278+
overflow: hidden !important;
279+
clip: rect(0, 0, 0, 0) !important;
280+
white-space: nowrap !important;
281+
border: 0 !important;
282+
}

0 commit comments

Comments
 (0)