Skip to content

Truncate list of terms in other languages#1843

Merged
osma merged 2 commits intomainfrom
issue1838-truncate-terms-in-other-languages
Dec 2, 2025
Merged

Truncate list of terms in other languages#1843
osma merged 2 commits intomainfrom
issue1838-truncate-terms-in-other-languages

Conversation

@osma
Copy link
Member

@osma osma commented Nov 27, 2025

Reasons for creating this PR

See #1838. This implements truncation for the list of terms in other languages on the concept page:

Here is how the result looks like on the YKL/PLC page 32.1 Political systems:
kuva

Link to relevant issue(s), if any

Description of the changes in this PR

  • extend the code in truncate-property-values.js to also handle lists of terms in other languages, which has a somewhat different DOM structure than regular properties
  • add a test vocabulary altlabel which contains a concept that has very many English and Finnish language altlabels
  • add a Cypress test that tests the truncation functionality with the help of the altlabel vocabulary

Known problems or uncertainties in this PR

  1. The limit on the number of items shown is hardcoded at 15, as before. This makes sense for regular properties, but for these terms in other languages, it could perhaps be a bit smaller than that.
  2. One of the Cypress tests in global-search-bar.cy.js broke due to the addition of the new altlabel vocabulary. For some reason the testUnknownPropertyOrder vocabulary disappeared from the vocabulary selection menu and was replaced by altlabel. I don't quite understand what happened here; why does the menu only show two vocabularies and not e.g. three? I modified the Cypress test accordingly, but there could be a bug hiding somewhere behind this strange behavior of the vocabulary selection menu.

Checklist

  • phpUnit tests pass locally with my changes
  • I have added tests that show that the new code works, or tests are not relevant for this PR (e.g. only HTML/CSS changes)
  • The PR doesn't reduce accessibility of the front-end code (e.g. tab focus, scaling to different resolutions, use of .sr-only class, color contrast)
  • The PR doesn't introduce unintended code changes (e.g. empty lines or useless reindentation)

@osma osma added this to the 3.0 milestone Nov 27, 2025
@osma osma self-assigned this Nov 27, 2025
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
73.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@osma osma moved this to Needs review in Skosmos 3.x Backlog Nov 27, 2025
Copy link
Contributor

@joelit joelit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! IMO duplicated lines in cypress tests are fine, and SonarQube should be ignored for those.

@osma osma merged commit 072d67f into main Dec 2, 2025
15 of 16 checks passed
@osma osma deleted the issue1838-truncate-terms-in-other-languages branch December 2, 2025 08:52
@github-project-automation github-project-automation bot moved this from Needs review to Issue/PR closed in Skosmos 3.x Backlog Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Truncate list of terms in other languages with "show all X values" button

2 participants