vmware-archive/clarity

The internal clarity NgControlService should be exposed.

TodorBonchev opened this issue · 2 comments

Describe the bug

We have a component with a clarity selector component and a clarity modal dialog. In the clarity modal dialog we show a clarity datagrid. When the modal is opened the NgControlService sets the control to some elements in the clarity datagrid and after the modal is closed the control is not returned to the clarity selector and the validations couldn't be triggered.
In order to workaround this problem I have to write this code:

        const controlStateService: IfControlStateService = this.comboboxComponent['controlStateService'];
        if (!controlStateService) {
            console.error('controlStateService of clarity combobox is undefined.');
        } else {
            const ngControlService = controlStateService['ngControlService'];
            if (!ngControlService) {
                console.error('ngControlService of IfControlStateService is undefined');
            } else {
                ngControlService.setControl(this.controlBase);
            }
        }

to access the NgControlService and set the control to the selector component manually.

The clarity components should either expose the NgControlService as a public service or automatically detect which is the active control and make the validation working in all cases.

Versions

Clarity project:

  • Clarity Core
  • Clarity Angular/UI

Clarity version:

  • v3.x
  • v4.x
  • v5.x

Framework:

  • Angular
  • React
  • Vue
  • Other:

Framework version:

: Angular 11_

The bug is not specific to a particular device.

Hi Todor,
Please provide a StackBlitz reproduction so we can verify the usage case and see where the problem is.
https://stackblitz.com/@clr-team/

Hi there 👋, this is an automated message. To help Clarity keep track of discussions, we automatically lock closed issues after 14 days. Please look for another open issue or open a new issue with updated details and reference this one as necessary.