jossmac / jossmac/react-images

Make getAltText optional

Open
#296 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.3k
Forks
433
PR merge metrics
No merged PRs in 30d

Description

I wanted to translate the navigation texts in french.
I used the "formatter" prop, however, for some reason the getAltText function is mandatory.

**Steps to reproduce the behavior:**

```
const formatters = {
getNextTitle: () => { return "Suivant (flèche droite)"; }, // Next (right arrow)
getPrevTitle: () => { return "Précédent (flèche gauche)"; } // Previous (left arrow)
}


```

**Expected behavior:**

Supply formatters with an empty object should not modify the behaviour.
Better document getAltText

**Actual behavior:**

1) Crash : getAltText is mandatory
2) getAltText doesn't take a CommonProps parameter as it's written in the doc (https://jossmac.github.io/react-images/#/)
It receives this :
`{index: 3, data: { a ViewType item }}`

Thanks

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.