[MGNLUI-7884] RichText fields are editable tho the "Save changes" button is disabled Created: 27/Feb/23  Updated: 09/May/23  Resolved: 16/Mar/23

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: 6.2.28
Fix Version/s: 6.3.0, 6.2.30

Type: Bug Priority: Neutral
Reporter: Carlos Cantalapiedra Assignee: Quach Hao Thien
Resolution: Fixed Votes: 0
Labels: VN-Analysis, VN-Testing
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: 7h Time Spent: 7h
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Attachments: Zip Archive my-fourth-module.zip    
Issue Links:
Problem/Incident
Relates
relates to MGNLUI-6958 ReadOnly RichTextField still accepts ... Open
relation
is related to MGNLUI-7270 Disable save action when showing vers... Closed
Sub-Tasks:
Key
Summary
Type
Status
Assignee
MGNLUI-7922 Implementation Sub-task Completed Quach Hao Thien  
MGNLUI-7923 Review Sub-task Completed Adam Siska  
MGNLUI-7924 PreintQA Sub-task Completed Adam Siska  
MGNLUI-7925 QA Sub-task Completed Daniel Alonso  
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[X]* Steps to reproduce, expected, and actual results filled
[X]* Affected version filled
Release notes required:
Yes
Date of First Response:
Epic Link: Nucleus Quality Maintenance
Sprint: Nucleus 32
Story Points: 1
Team: Nucleus
Work Started:

 Description   

Steps to reproduce

  1. Start a 6.2.28 magnolia bundle
  2. Within the light-modules folder, copy the attached module 
  3. Start Magnolia
  4. Open the AppContent app and create a new item
  5. Publish it
  6. Edit the item and publish it 
  7. Select the item and clic on "Show versions" action
  8. Select the first version (1.0) 
  9. Check the body field is editable 

Expected results

The richText field should be readonly

Actual results

The richText field can be edited tho it cannot be saved because the "Save changes" button is disabled

Workaround

N/A

Development notes

Looks similar to https://jira.magnolia-cms.com/browse/MGNLUI-7270



 Comments   
Comment by Vishal Bargode [ 02/Mar/23 ]

Hi Team, Any estimated version or date? For this bug.

Comment by Quach Hao Thien [ 03/Mar/23 ]

Discovery

As stated in this discovery https://jira.magnolia-cms.com/browse/MGNLUI-7270?focusedId=325630&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-325630, there isn't a direct way to setEnable(false) to a any child component of a disabled parent component.

So, for this issue there are 2 proposal:

  1. Using css to disable the ckeditor
.v-ckeditortextfield.v-disabled * {
  pointer-events: none;    
  cursor: none;
} 
    • Pros: Quickwin
    • Cons: The field's body is still accessible via TAB key
  1. Check all the ancestors of ckEditor while the attach() is execute whether any parent component been disable and then reset disable status of ckEditor, info.magnolia.ui.vaadin.ckeditor.MagnoliaCKEditorTextField
@Override
public void attach() {
    super.attach();
    this.setEnabled(isParentEnabled());
    this.setReadOnly(!isParentEnabled());
    this.setProtectedBody(!isParentEnabled());
} 

private boolean isParentEnabled() {
    HasComponents parent = this.getParent();
    boolean isEnable = true;
    while(parent != null) {
        try {
            isEnable = isEnable && parent.getParent().isEnabled();
            parent = parent.getParent();
        } catch (Exception e) {
            parent = null;
        }
    }
    return isEnable;
}
    • Pros: Problem solved
    • Cons: hacky, more complex, need to be handle with care because the field definition itself has the property to set disable/readonly 
Comment by Vishal Bargode [ 09/Mar/23 ]

Hi Team,

Is above solution we need to implement in our code ? 

OR

It will be part of Magnolia Release ? If Yes, then can we have release version / date ?

Generated at Mon Feb 12 09:50:11 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.