-
Notifications
You must be signed in to change notification settings - Fork 541
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix HTML generation for content descriptions (particularly for answers) #4848
Labels
bug
End user-perceivable behaviors which are not desirable.
Impact: Low
Low perceived user impact (e.g. edge cases).
Work: Medium
The means to find the solution is clear, but it isn't at good-first-issue level yet.
Milestone
Comments
6 tasks
6 tasks
adhiamboperes
added a commit
that referenced
this issue
Jan 14, 2025
…in CustomHtmlContentHandler (#5614) <!-- READ ME FIRST: Please fill in the explanation section below and check off every point from the Essential Checklist! --> ## Explanation <!-- - Explain what your PR does. If this PR fixes an existing bug, please include - "Fixes #bugnum:" in the explanation so that GitHub can auto-close the issue - when this PR is merged. --> Fix #4848: This PR resolves the issue with incomplete content descriptions being generated for custom HTML tags. The existing implementation stripped out spans and custom tag content, leading to incomplete descriptions. The updated implementation introduces a custom generation pipeline for content descriptions in `CustomHtmlContentHandler`. It ensures that all custom tag content is correctly processed and appended, resulting in complete and accurate descriptions. ### Key Changes: - Added a `StringBuilder` to accumulate content descriptions and a `MutableMap` to handle custom tag descriptions. - Implemented `getContentDescription()` to combine default text with custom tag content descriptions, ensuring seamless integration. - Introduced a `ContentDescriptionProvider` interface for handling custom tags. - Updated relevant tag handlers (`ImageTagHandler`, `ConceptCardTagHandler`, `LiTagHandler`, `PolicyPageTagHandler` and `MathTagHandler`) to implement the new interface. - Verified the implementation with appropriate test cases. ## Essential Checklist <!-- Please tick the relevant boxes by putting an "x" in them. --> - [x] The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".) - [x] Any changes to [scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets) files have their rationale included in the PR explanation. - [x] The PR follows the [style guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide). - [x] The PR does not contain any unnecessary code changes from Android Studio ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)). - [x] The PR is made from a branch that's **not** called "develop" and is up-to-date with "develop". - [x] The PR is **assigned** to the appropriate reviewers ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)). --------- Co-authored-by: Adhiambo Peres <[email protected]>
The issue is reopened because of the following unresolved TODOs: Line 2291 in 4f5aec6
|
@manas-yu, PTAL |
This was referenced Jan 15, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
End user-perceivable behaviors which are not desirable.
Impact: Low
Low perceived user impact (e.g. edge cases).
Work: Medium
The means to find the solution is clear, but it isn't at good-first-issue level yet.
This was discovered as part of #4846. We currently generate content descriptions by parsing HTML and then converting that to a string (which strips the spans from the generated HTML). The problem with this approach is it leads to the custom tag text also being stripped out, which leads to incomplete strings like this:
(Notice the lack of context before the '.').
The correct version would actually be:
We probably need to introduce a custom generation pipeline for content descriptions in CustomHtmlContentHandler to ensure these cases can be properly covered. We also should be checking for other link cases, including anchors, or any case when text can appear between tags.
The text was updated successfully, but these errors were encountered: