Skip to content

Commit 68b46fe

Browse files
authored
docs: document image zoom feature with :zoom: directive option (#503)
* Document image zoom and lightbox features Add comprehensive documentation for the new image zoom/lightbox feature available in the TYPO3 documentation theme. Extension authors can now use CSS classes to enable different zoom modes on figures and images. Coverage includes: - Five zoom modes: lightbox, gallery, inline, lens, and css-only - Practical RST examples for each mode - Accessibility features (keyboard navigation, ARIA, screen readers) - Best practices and use case guidance - JavaScript-free fallback option This enables extension authors to enhance image viewing in their documentation without requiring custom JavaScript or external plugins. * Fix keyboard navigation docs for Inline and Lens modes - Inline zoom has full keyboard support: Tab, +/-, arrows, ESC/0 - Lens mode has keyboard activation: Tab, Enter/Space, arrows, ESC * docs: update zoom syntax to use :zoom: option instead of class * docs: add zoom-factor option and version note - Document :zoom-factor: option for lens mode magnification - Add versionadded directive noting feature requires v0.2.0+ * fix: correct render-guides version to 0.36.0 * docs: add :zoom: lightbox to standard image examples Per review feedback, add :zoom: lightbox to the basic examples so users copying them will use zoom by default for screenshots.
1 parent cc815d5 commit 68b46fe

File tree

1 file changed

+207
-0
lines changed
  • Documentation/Reference/ReStructuredText/Graphics

1 file changed

+207
-0
lines changed

Documentation/Reference/ReStructuredText/Graphics/Images.rst

Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Optional parameters for images and figures:
3838
* `:target:` link target
3939
* `:width:` : width of image, use for example px (for example `:width: 100px`
4040
* `:scale:` : scale images, for example `:scale: 65`
41+
* `:zoom:` : enable zoom functionality (see :ref:`image-zoom`)
4142

4243
Additional parameters can be found on the docutils page `reStructuredText Directives
4344
<http://docutils.sourceforge.net/0.4/docs/ref/rst/directives.html#image>`__
@@ -52,6 +53,7 @@ Example 1: Scaled image with shadow and link target
5253
:target: https://typo3.org
5354
:class: with-shadow
5455
:scale: 50
56+
:zoom: lightbox
5557

5658
.. code-block:: rst
5759
:linenos:
@@ -61,6 +63,7 @@ Example 1: Scaled image with shadow and link target
6163
:target: https://typo3.org
6264
:class: with-shadow
6365
:scale: 50
66+
:zoom: lightbox
6467
6568
.. _image-caption:
6669

@@ -71,6 +74,7 @@ Example 2: Image with caption and fixed width
7174
:alt: Left floating image
7275
:target: https://typo3.org
7376
:width: 100px
77+
:zoom: lightbox
7478

7579
This is the image caption
7680

@@ -81,5 +85,208 @@ Example 2: Image with caption and fixed width
8185
:alt: some image
8286
:target: https://typo3.org
8387
:width: 100px
88+
:zoom: lightbox
8489
8590
This is the image caption
91+
92+
.. _image-zoom:
93+
94+
Image zoom and lightbox features
95+
=================================
96+
97+
.. versionadded:: 0.36.0
98+
The image zoom feature was introduced in render-guides version 0.36.0.
99+
100+
The TYPO3 documentation theme provides built-in image zoom and lightbox
101+
features to enhance the viewing experience for images and figures. These
102+
features allow readers to view images in greater detail without leaving
103+
the documentation page.
104+
105+
Available zoom modes
106+
--------------------
107+
108+
The zoom functionality is controlled by the `:zoom:` option on figure
109+
and image directives. The following zoom modes are available:
110+
111+
.. rst-class:: dl-parameters
112+
113+
`lightbox`
114+
Click to open the image in a full-screen overlay dialog. The lightbox
115+
provides a dark backdrop and centers the image. Click outside the image
116+
or press Escape to close. A zoom indicator icon appears on the image.
117+
118+
**Use case**: Screenshots, diagrams, and any image that benefits from
119+
full-screen viewing. This is the recommended mode for most images.
120+
121+
`gallery`
122+
Click to open the image in a gallery viewer with mouse wheel zoom
123+
and navigation between grouped images. Use the `:gallery:` option to
124+
group related images together.
125+
126+
**Use case**: Series of screenshots, step-by-step tutorials, or image
127+
collections that should be navigable together.
128+
129+
`inline`
130+
Enables scroll wheel zoom directly on the image without opening an
131+
overlay. When zoomed, drag to pan. Double-click or press Escape to reset.
132+
133+
**Use case**: Detailed diagrams or technical drawings that need frequent
134+
zoom inspection without leaving context.
135+
136+
`lens`
137+
A magnifier lens follows the cursor when hovering over the image,
138+
showing a zoomed view. A result panel appears beside the image with
139+
the magnified area.
140+
141+
**Use case**: High-resolution images with fine details, such as UI
142+
mockups or detailed screenshots.
143+
144+
Directive options
145+
-----------------
146+
147+
The following options are available for the figure and image directives:
148+
149+
.. rst-class:: dl-parameters
150+
151+
`:zoom:`
152+
The zoom mode to use. One of: `lightbox`, `gallery`, `inline`, `lens`.
153+
154+
`:gallery:`
155+
Group name for gallery mode. Images with the same gallery name can be
156+
navigated together. Only used with `:zoom: gallery`.
157+
158+
`:zoom-indicator:`
159+
Whether to show the zoom indicator icon. Set to `false` to hide it.
160+
Default is `true` (shown).
161+
162+
`:zoom-factor:`
163+
Magnification factor for lens mode. Default is `2`. Higher values
164+
provide stronger magnification. Only used with `:zoom: lens`.
165+
166+
Usage examples
167+
--------------
168+
169+
Example 3: Lightbox zoom
170+
~~~~~~~~~~~~~~~~~~~~~~~~~
171+
172+
.. figure:: /_Images/a4.jpg
173+
:alt: Example screenshot
174+
:zoom: lightbox
175+
:class: with-border with-shadow
176+
177+
Click to open in lightbox. This is the recommended mode for most images.
178+
179+
.. code-block:: rst
180+
181+
.. figure:: /_Images/a4.jpg
182+
:alt: Example screenshot
183+
:zoom: lightbox
184+
:class: with-border with-shadow
185+
186+
Click to open in lightbox.
187+
188+
Example 4: Gallery mode with grouped images
189+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
190+
191+
.. code-block:: rst
192+
193+
.. figure:: /_Images/step1.png
194+
:alt: Step 1
195+
:zoom: gallery
196+
:gallery: tutorial
197+
198+
First step of the tutorial.
199+
200+
.. figure:: /_Images/step2.png
201+
:alt: Step 2
202+
:zoom: gallery
203+
:gallery: tutorial
204+
205+
Second step - navigate with arrow keys.
206+
207+
Example 5: Inline scroll-wheel zoom
208+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
209+
210+
.. code-block:: rst
211+
212+
.. figure:: /_Images/diagram.png
213+
:alt: Architecture diagram
214+
:zoom: inline
215+
216+
Use scroll wheel to zoom in/out directly on this image.
217+
218+
Example 6: Magnifier lens
219+
~~~~~~~~~~~~~~~~~~~~~~~~~~
220+
221+
.. code-block:: rst
222+
223+
.. figure:: /_Images/detailed-ui.png
224+
:alt: User interface mockup
225+
:zoom: lens
226+
227+
Hover over the image to see a magnified view.
228+
229+
Example 7: Hidden zoom indicator
230+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
231+
232+
.. code-block:: rst
233+
234+
.. figure:: /_Images/screenshot.png
235+
:alt: Screenshot
236+
:zoom: lightbox
237+
:zoom-indicator: false
238+
239+
Lightbox without visible indicator icon.
240+
241+
Accessibility considerations
242+
-----------------------------
243+
244+
All zoom modes are designed with accessibility in mind:
245+
246+
Keyboard navigation
247+
~~~~~~~~~~~~~~~~~~~
248+
249+
* **Lightbox and Gallery modes**: Full keyboard support
250+
251+
* :kbd:`Tab` - Navigate to image and controls
252+
* :kbd:`Enter` or :kbd:`Space` - Open lightbox/gallery
253+
* :kbd:`Escape` - Close lightbox/gallery
254+
* :kbd:`Arrow Left` / :kbd:`Arrow Right` - Navigate between images (gallery)
255+
* :kbd:`+` / :kbd:`-` - Zoom in/out (gallery)
256+
257+
* **Inline zoom mode**: Full keyboard support
258+
259+
* :kbd:`Tab` - Focus the image
260+
* :kbd:`+` / :kbd:`-` - Zoom in/out
261+
* :kbd:`Arrow keys` - Pan when zoomed
262+
* :kbd:`Escape` or :kbd:`0` - Reset zoom
263+
264+
* **Lens mode**: Keyboard activation supported
265+
266+
* :kbd:`Tab` - Focus the image
267+
* :kbd:`Enter` or :kbd:`Space` - Toggle lens on/off
268+
* :kbd:`Arrow keys` - Move lens position
269+
* :kbd:`Escape` - Deactivate lens
270+
271+
Screen reader support
272+
~~~~~~~~~~~~~~~~~~~~~~
273+
274+
All zoom modes maintain proper ARIA attributes and provide descriptive
275+
labels for assistive technologies. Always use the `:alt:` option to
276+
provide descriptive alternative text for images.
277+
278+
Reduced motion support
279+
~~~~~~~~~~~~~~~~~~~~~~~
280+
281+
The zoom functionality respects the `prefers-reduced-motion` media query.
282+
When reduced motion is preferred, transitions and animations are disabled.
283+
284+
Best practices
285+
--------------
286+
287+
* Always include descriptive `:alt:` text for accessibility
288+
* Use `lightbox` as the default for most images
289+
* Use `:gallery:` to group related images for navigation
290+
* Use `inline` for technical diagrams that need frequent inspection
291+
* Combine with `:class: with-border with-shadow` for better visual presentation
292+
* Test zoom functionality with keyboard navigation

0 commit comments

Comments
 (0)