deoostfrees / parvus Goto Github PK
View Code? Open in Web Editor NEWAn open source, dependency free image lightbox with the goal of being accessible.
Home Page: https://codepen.io/collection/DwLBpz
License: MIT License
An open source, dependency free image lightbox with the goal of being accessible.
Home Page: https://codepen.io/collection/DwLBpz
License: MIT License
Tested with Safari / Firefox / Brave + iPhone.
(use the demo to play along)
Observed behaviour or actual result: the first/last image gives the impression of (briefly) sliding away to make place for the next one. Nothing happens however
Expected behaviour:
the button is disabled (and hidden or greyed out), pressing the arrow keys does nothing.
Note: the buttons have the aria-disabled attribute set (true
), but the buttons are not actually disabled.
This worked as expected in Parvus 2.3.*
I was doing some testing with a placeholder service where the URL didn't end with a proper extension, and while these URLs work just fine in an image tag, Parvus threw this in the console.
parvus.min.js:11
Uncaught Error: https://placehold.co/600x400/png
at D (parvus.min.js:11:3094)
at parvus.min.js:11:2706
at NodeList.forEach (<anonymous>)
at Y (parvus.min.js:11:2693)
at new t (parvus.min.js:11:16608)
at HTMLDocument.init ((index):60:2)
Hi,
thanks for this awesome, accessible lightbox! :)
I ran into an issue importing the l10n files.
When I try to import them like this:
import de from 'parvus/src/l10n/de';
I get an error in my bundler (= vite):
Missing "./src/l10n/de" specifier in "parvus" package
Looks like there is an error in the package configuration.
I had the same issue with the styles, but I got it working once i moved the import into my scss-files and used an absolute path.
// won't work
@import 'parvus/src/scss/parvus';
// works
@import '/node_modules/parvus/src/scss/parvus';
Would be nice if you could manage to fix this.
Thanks! :)
Combine a group of images into a set with the data-group
attribute.
I find swiping on slides to be a very weird experience when using a mouse or trackpad, and would like to disable it by checking window.matchMedia("(pointer: fine)")
before initializing Parvus.
When I implement Parvus, I'm getting multiple instances of the same image with an error in the console:
See this screencast: https://cloudup.com/cXEouIO2f3S
parvus.js:440 Uncaught Error: Ups, I'm already closed.
at close (parvus.js:440)
close @ parvus.js:440
I'm including the library like this after I install with yarn:
import Parvus from 'parvus';
export default {
init() {
const prvs = new Parvus();
prvs();
}
}
it will be great if it get images as an array and handle theme as gallery to see prev and next image
Only briefly looked at the demo, but one thing that strikes me...it would be nice to have an explicit close button (that can receive focus as well), as relying purely on the user's ability to either press Esc or clicking on the enlarged image may not work that well for touchscreen+AT users.
Improve the appearance/ positioning of the captions.
Add option (https://github.com/deoostfreese/Parvus#options) to make the hardcoded supported images file extensions
customizable:
Current behaviour - based on the CodePen example:
Opening a gallery does not stop scrolling. The user can dismiss the image via touch (or dragging).
Desired behaviour:
a.) Scrolling would dismiss the image, similiar to https://github.com/francoischalifour/medium-zoom
b.) Scrolling would be locked if a Parvus lightbox is open
Originally posted by vikasneugi March 10, 2023
At the moment, it seems to me impossible to expand with your fingers an expanded parvus image on mobile.
Is there any way for touch enabled zoom for the expanded image for mobile?
Only briefly tested the codepen demo, but it seems that even when the lightbox is open, I can swipe to/reach the underlying page. This is likely due to the fact that VO doesn't do anything special regardless of the role="dialog"
(it doesn't automagically hide the underlying page from the accessibility tree). This may need an explicit addition of aria-hidden="true"
(making sure the actual dialog container itself is not a child element of the hidden container).
I created a reduced test case that showcases this behavior on CodePen:
Different Browsers produce different results.
Chrome & Edge:
Safari:
Chrome & Edge:
The image is invisible when you open it the second time.
Safari:
The image is invisible in the Lightbox upon first click / fresh cache. The image does show if you click to open it again.
It appears the image is indeed in the DOM when it's "invisible"; however, inline styles are setting the width
and height
to 0
, which causes the image to be invisible.
The image(s) should display when you click to open it.
Just based on the codepen, I'd suggest improving (explicitly setting) :focus
styles.
In Firefox, the focus around the demo page's images is quite faint (the default dotted outline)
This may just be something to add/suggest in the demo itself. However, the close button may benefit from a defined style in parvus' own stylesheet.
Focus indication on the close button in Firefox is a very faint gray
In Chrome, the default for the images is fine, but the close button's style is again almost imperceptible
non-focused vs. focused
maybe something simple/consistent like swapping foreground/background?
.parvus__btn--close:focus {
background-color: var(--button-color);
color: var(--button-background-color);
border-color: var(--button-background-color);
}
Hey, quick question... is there a way to grab the data-attribute value instead of the href?
I have this halftone effect script which replaces the original img with a set of dynamic elements, effectively rendering the Lightbox useless because there's no href anymore. Would be nice to be still able to use a lightbox on those.
P.S. I know I can wrap those elements with <a href= class=> but I was just wondering if there was more elegand way of doing this. thank you!
I would like to access the clicked element after the lightbox opens. Being able to pass data from the original HTML to the modal would be useful.
Maybe a property on the event like this:
const prvs = Parvus();
prvs.on("open", (event) => {
alert("You opened the element with the caption: " + event.source.dataset.caption);
});
Is there anyway to display captions from a data or title attribute?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.