Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation Link stores url as id #31254

Closed
gwwar opened this issue Apr 27, 2021 · 2 comments · Fixed by #31259
Closed

Navigation Link stores url as id #31254

gwwar opened this issue Apr 27, 2021 · 2 comments · Fixed by #31259
Assignees
Labels
[Block] Navigation Affects the Navigation Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@gwwar
Copy link
Contributor

gwwar commented Apr 27, 2021

After adding a custom link, the block id attribute is set to the url value. In this case we'd expect no id attribute to be set for a custom link.

With work in #31004 we may also want to add the a kind value of custom

idbug.mp4
@gwwar gwwar added [Type] Bug An existing feature does not function as intended [Block] Navigation Affects the Navigation Block labels Apr 27, 2021
@gwwar
Copy link
Contributor Author

gwwar commented Apr 27, 2021

Looks like it's coming from

export const handleDirectEntry = ( val ) => {
let type = 'URL';
const protocol = getProtocol( val ) || '';
if ( protocol.includes( 'mailto' ) ) {
type = 'mailto';
}
if ( protocol.includes( 'tel' ) ) {
type = 'tel';
}
if ( startsWith( val, '#' ) ) {
type = 'internal';
}
return Promise.resolve( [
{
id: val,
title: val,
url: type === 'URL' ? prependHTTP( val ) : val,
type,
},
] );
};

The type value for a custom link can be URL, mailto, tel or internal

@getdave
Copy link
Contributor

getdave commented Apr 29, 2021

we'd expect no id attribute to be set for a custom link.

That's 💯 . We definitely do not need an ID for custom. Indeed I've specifically guarded against that case in #31004

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Navigation Affects the Navigation Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
2 participants