Skip to content

Navigation.showError() modals are unable to be dismissed #52

@dnicolson

Description

@dnicolson

Modal dialogs created with navigationDocument.presentModal() are able to be dismissed but using Navigation.showError() results in a dialog where the button does not work, escape or home must be used to dismiss.

Consider the following code if added to the Movie Catalog example app in the ready method of the HomePage object:

const showError = () => {
  // const alert = `<?xml version="1.0" encoding="UTF-8" ?>
  //     <document>
  //       <alertTemplate>
  //         <title>Error</title>
  //         <description>This modal cannot be dismissed.</description>
  //         <button data-alert-dissmiss="close">
  //           <text>OK</text>
  //         </button>
  //       </alertTemplate>
  //     </document>`;
  // const error = ATV.Navigation.showError({ template: alert, style: '' });

  const alert = `<?xml version="1.0" encoding="UTF-8" ?>
    <document>
      <alertTemplate>
        <title>Error</title>
        <description>This modal can be dismissed.</description>
        <button>
          <text>OK</text>
        </button>
      </alertTemplate>
    </document>`;
  const parser = new DOMParser();
  const error = parser.parseFromString(alert, 'application/xml');
  navigationDocument.presentModal(error);

  error.addEventListener('select', () => {
    ATV.Navigation.dismissModal();
  })
};

The uncommented version works as expected. Inverting the commented code results in the modal not being dismissed but with the data-alert-dissmiss [sic] attribute the navigationDocument.dismissModal() method is called, as indicated by the log:
close button clicked within the modal, dismissing modal...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions