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

Lightbox2 requires a lot of redundant markup #682

Open
belg4mit opened this issue Jun 18, 2020 · 1 comment
Open

Lightbox2 requires a lot of redundant markup #682

belg4mit opened this issue Jun 18, 2020 · 1 comment

Comments

@belg4mit
Copy link

belg4mit commented Jun 18, 2020

Lightbox2 requires a lot of redundant markup to produce reasonably compliant HTML, specifically data-title and data-alt on the link. That these is supported is great. However, they should be optional (which they are), but if missing and an alt or title is supplied for an enclosed image, these could reasonably be used for the lightbox itself.

In other words, both of these items should be equivalent:
<a href="/foo" data-lightbox="bar"><img src="/baz" alt="quux" title="wibble"></a> <a href="/foo" data-lightbox="bar" data-lart="quux" data-title="wibble"><img src="/baz" alt="quux" title="wibble"></a>

Ideally, this abbreviated form would also expand out as well:
<a href="/foo" data-lightbox="bar"><img src="/baz" alt="quux"></a> <a href="/foo" data-lightbox="bar" data-alt="quuz" data-title="quux"><img src="/baz" alt="quux"></a>

This arguably is not a bug, but you have no mechanism for feature requests, so I'm submitting this anyway.

@lokesh
Copy link
Owner

lokesh commented Jun 28, 2020

@belg4mit You bring up some interesting ideas around developer convenience:

alt
If an alt attribute is specified on the trigger image, that could be reused by the full-size image shown in the lightbox, as most cases, the thumbnail represents the same image, just scaled up. I need to think through the implementation a bit as the trigger could contain more than one image or mixed content, though this is uncommon.

title
Having the alt attribute fill-in for any missing title attribute is riskier as the title (aka caption) and the alt attribute values often serve two different purposes, one for screen readers to describe the subject matter of the image and the other a caption for sighted readers to provide complementary information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants