Skip to content
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: keep style attribute intact when importing QTI #2683

Merged

Conversation

wazelin
Copy link
Member

@wazelin wazelin commented Feb 12, 2025

COECDP25-1009

This PR partially reverts #343 in an attempt to keep the style attributes intact when importing QTI.

Copy link

github-actions bot commented Feb 12, 2025

Front-end summary Node 18

💯 Total ✅ Passed ⏭️ Skipped ❌ Failed
287 287 0 0

foreach ($xpath->query("//*[local-name() = 'itemBody']//*[@style]") as $elementWithStyle) {
$elementWithStyle->removeAttribute('style');
}
// foreach ($xpath->query("//*[local-name() = 'itemBody']//*[@style]") as $elementWithStyle) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch @wazelin . IF you feel we may have trouble disabling it, since it is enabled for 10y, we may add a FF for that and enable it only for the client that wants to use this:

if ($featureFlagChecker->isEnabled('FEATURE_FLAG_ALLOW_QTI_STYLE_ATTR')) {
...
}

Copy link
Member Author

Choose a reason for hiding this comment

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

That restriction is very superficial: it only removes the attribute on import. We support it throughout the rest of the flow: export, publication, compilation, runtime.

Both Terre UI and Solar UI work fine.

That does not make our item bank QTI incompliant – we still support the strict QTI items.

Copy link
Contributor

@gabrielfs7 gabrielfs7 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the quick fix, @wazelin

Left a small comment about using a feature flag, since inline styles are not QTI compliant.

  • New code is covered by tests (if applicable)
  • Tests are running successfully (old and new ones) on my local machine (if applicable)
  • New code is respecting code style rules
  • New code is respecting best practices
  • New code is not subject to concurrency issues (if applicable)
  • Feature is working correctly on my local machine (if applicable)
  • Acceptance criteria are respected
  • Pull request title and description are meaningful

@wazelin wazelin force-pushed the fix/COECDP25-1009/keep-style-attribute-on-qti-import branch from c6cf893 to daa200b Compare February 12, 2025 15:33
Copy link

Version

Target Version 30.30.2
Last version 30.30.1

There are 0 BREAKING CHANGE, 0 feature, 1 fix

@wazelin wazelin merged commit 239e63a into develop Feb 12, 2025
5 checks passed
@wazelin wazelin deleted the fix/COECDP25-1009/keep-style-attribute-on-qti-import branch February 12, 2025 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants