Skip to content

Commit

Permalink
fixed a11y Caption Issues (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
Molochem authored Feb 9, 2024
1 parent 2d75afd commit 54aca2d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions news/341.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed the Caption for Images, Video Blocks etc. to use semantically correct HTML Structure @Molochem
10 changes: 5 additions & 5 deletions src/components/Caption/Caption.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ const Caption = ({ as = 'figcaption', title, description, credit }) => {

return (
<As>
{title && <div className="title">{title}</div>}
{title && <h2 className="title">{title}</h2>}
{description && (
<div className="description">
<p className="description">
{description.split('\n').map((line, index) => (
<div key={index}>{line || '\u00A0'}</div>
<p key={index}>{line || '\u00A0'}</p>
))}
</div>
</p>
)}
{credit && <div className="credits">{credit}</div>}
{credit && <p className="credits">{credit}</p>}
</As>
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/theme/blocks/_image.scss
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ figcaption {
}

.description {
div,
p,
a {
@include marginal-description();
}
Expand Down

0 comments on commit 54aca2d

Please sign in to comment.