mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-18 19:46:57 +02:00
fix(v2): Allow the alt for the logo to be empty (#3352)
See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Img#Attributes > Setting this attribute to an empty string (alt="") indicates that > this image is not a key part of the content (it’s decoration or a > tracking pixel), and that non-visual browsers may omit it from > rendering. Since the logo is indeed decorative and redundant with the actual project name, an empty alt is fine.
This commit is contained in:
parent
c7fc781ce0
commit
56c04c7834
2 changed files with 17 additions and 1 deletions
|
@ -93,6 +93,22 @@ describe('themeConfig', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should allow empty alt tags for the logo image in the header', () => {
|
||||||
|
const altTagConfig = {
|
||||||
|
navbar: {
|
||||||
|
logo: {
|
||||||
|
alt: '',
|
||||||
|
src: '/arbitrary-logo.png',
|
||||||
|
},
|
||||||
|
hideOnScroll: false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
expect(testValidateThemeConfig(altTagConfig)).toEqual({
|
||||||
|
colorMode: DEFAULT_COLOR_MODE_CONFIG,
|
||||||
|
...altTagConfig,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test('should accept valid prism config', () => {
|
test('should accept valid prism config', () => {
|
||||||
const prismConfig = {
|
const prismConfig = {
|
||||||
prism: {
|
prism: {
|
||||||
|
|
|
@ -181,7 +181,7 @@ const ThemeConfigSchema = Joi.object({
|
||||||
items: Joi.array().items(NavbarItemSchema),
|
items: Joi.array().items(NavbarItemSchema),
|
||||||
title: Joi.string().allow('', null),
|
title: Joi.string().allow('', null),
|
||||||
logo: Joi.object({
|
logo: Joi.object({
|
||||||
alt: Joi.string(),
|
alt: Joi.string().allow(''),
|
||||||
src: Joi.string().required(),
|
src: Joi.string().required(),
|
||||||
srcDark: Joi.string(),
|
srcDark: Joi.string(),
|
||||||
href: Joi.string(),
|
href: Joi.string(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue