Support icons for custom EditingAction items in text selection menus

Open
#788 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Quiet
Tech stack
swift
Domain
mobile

Research direction

Start by reading the EditingAction(title:action:) API and the code that turns custom actions into UIKit UIMenuItem items. Check how UIKit's modern UIMenuElement or UICommand APIs represent images, then assess where an optional image can fit. Done means apps can provide an icon for a custom EPUB selection action and UIKit can display it in the expanded edit menu when appropriate.

Written by the indexing model from the issue text.

Description

Describe the bug

Summary

Readium currently lets apps add custom text selection actions with EditingAction(title:action:).

However, custom actions are backed by UIMenuItem(title:action:), which does not provide an image API. This means custom actions cannot show icons in the expanded iOS edit menu, while system actions or actions built with modern UIMenuElement / UICommand can show icons.

Current behavior

Custom EditingAction items appear without icons in the expanded system edit menu.

Expected behavior

Readium should provide a way for apps to optionally attach an icon to custom editing actions, so UIKit can display that icon in the expanded edit menu when appropriate.

How to reproduce?
  1. In the TestApp or an integrating app, add a custom EPUB editing action using EditingAction(title:action:).
  2. Select text in an EPUB.
  3. Open the expanded iOS edit menu.
  4. The custom action appears without an icon.
Image
Readium version

3.8.0

OS version

iOS 26.4

Testing device

iPhone 16

Environment

Additional context

Use case

Apps may want to provide custom EPUB text selection actions such as Highlight, Add note, Translate, or Share, and have them appear visually consistent with native iOS edit menu actions.

For example, an app might want to express:

EditingAction(
    title: "Highlight",
    image: UIImage(systemName: "highlighter"),
    action: #selector(highlightSelection)
)
Dominant language
Swift
Stars
557
Forks
249
Avg merge
3h 52m
Merged PRs (30d)
19

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from readium/swift-toolkit

All issues in readium/swift-toolkit

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.