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

Sharing modal generates nested <p>elements #1333

Open
Ldoppea opened this issue Aug 9, 2021 · 0 comments
Open

Sharing modal generates nested <p>elements #1333

Ldoppea opened this issue Aug 9, 2021 · 0 comments
Labels
bug Something isn't working cozy-sharing

Comments

@Ldoppea
Copy link
Member

Ldoppea commented Aug 9, 2021

When opening a sharing modal, recipients list uses a <Typography> component that generated nested <p> elements in DOM.

Nested <p> elements can be rendered but this does not produce a HTML document that is not conform with W3C specifications. A <p> element should contain only phrasing content : http://dev.w3.org/html5/spec/single-page.html#phrasing-content

This bug may be related to cozy-ui but the documentation seems not to have this problem: https://docs.cozy.io/cozy-ui/react/#!/Typography

Rendered component:
image

Generated DOM:
image

Error displayed in dev mode:
image

Code responsible for this component :

const Recipient = props => {
const { t } = useI18n()
const client = useClient()
const { instance, isOwner, status, ...rest } = props
const isMe =
(isOwner && status === 'owner') || instance === client.options.uri
const defaultDisplayName = t(DEFAULT_DISPLAY_NAME)
const name = getDisplayName(rest, defaultDisplayName)
return (
<CompositeRow
dense
className={cx(styles['recipient'], 'u-ph-0')}
primaryText={
<Typography className="u-ellipsis" variant="body1">
{isMe ? t('Share.recipients.you') : name}
</Typography>
}
secondaryText={<Status status={status} isMe={isMe} instance={instance} />}
image={<RecipientAvatar recipient={props} />}
right={<Permissions {...props} className="u-flex-shrink-0" />}
/>
)
}

@Ldoppea Ldoppea added bug Something isn't working cozy-sharing labels Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cozy-sharing
Projects
None yet
Development

No branches or pull requests

1 participant