When the h2 for message are built there is no id on them. If they had ids then links to them could be add to the page. This links (like skip to errrors) would help with accessibility a great deal.
I think this change would be very small.
I would think that messages-$theTypeOfMessage would work well

Comments

e2thex’s picture

Status: Active » Needs work
StatusFileSize
new627 bytes
new635 bytes

Attach is a patch (and its make friendly friend).

e2thex’s picture

Status: Needs work » Needs review
johnle’s picture

Issue summary: View changes

Looks like this patch can cause duplicate ID's in the h2 DOM element. Would it make more sense to pass it into the drupal_html_id() function?

robpowell’s picture

StatusFileSize
new693 bytes
new1.04 KB

I can't think of an example of why there would be multiple headers in the message container but in case there is I agree with John that drupal_html_id() is the better way to ensure unique id.

jenna.tollerson’s picture

Status: Needs review » Reviewed & tested by the community

Looks good!

poker10’s picture

Status: Reviewed & tested by the community » Needs review

Actually, this can be achieved easily by overriding the theme function theme_status_messages().

I am not sure we want to add this extra markup, as most sites won't benefit from this without additional effort. I suppose that sites with custom themes that needed this have already done this and other sites probably does not need this (and this patch would not help them either, because they will need to modify their themes also - which is similar effort to overriding the theme_status_messages() function). Lets discuss it a bit more.

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.