Problem/Motivation

As an admin I want to disable individual tests via the GUI.

User interface changes

This requires interfacing with the editoria11y javascript.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

oheller created an issue. See original summary.

itmaybejj’s picture

Status: Active » Postponed
nmillin’s picture

I'm interested in this feature. Is this something that is being worked on?
In looking at https://www.drupal.org/project/editoria11y/issues/3305813, there seems to be some v2 upgrades and I want to make sure I'm going down the correct rabbit hole. Right now I'm going down the hole of Ed11y.checkAll();

Thanks!

itmaybejj’s picture

I'm not working on anything tagged "postponed" at the moment.

nmillin’s picture

Gotcha. I was able to get something working using a custom test and removing individual tests that I don't want to show my content authors yet. I think this is something that could be done via config in the Drupal settings at /admin/config/content/editoria11y, but I don't want to go down that path if it isn't something you (@itmaybejj) are interested in.

Here is what I did:
https://editoria11y.princeton.edu/configuration/#customtests was used as the starting point
Right before step 4 (when ed11yResume is dispatched), I loop through Ed11y.results and remove all tests not in the allow list I created.

Code sample:

// Only allow the tests you want.
  var allowedTests = [
    // Tests from ed11y tests.
    'headingEmpty',
    'linkNoText',
    'tableNoHeaderCells',
    'tableEmptyHeaderCell',
    // etc...

    // Made sure custom tests are allowed.
    'outlookSafeLink',
  ];
  // These are all of the tests I found in ed11y-test-[type of test].js.
  // linkNewWindow
  // linkNoText
  // altEmptyLinked
  // linkDocument
  // linkTextIsURL
  // linkTextIsGeneric
  // textPossibleList
  // textPossibleHeading
  // textUppercase
  // tableNoHeaderCells
  // tableEmptyHeaderCell
  // tableContainsContentHeading
  // embedVideo
  // embedAudio
  // embedVisualization
  // embedTwitter
  // embedCustom
  // headingEmpty
  // headingIsLong
  // headingLevelSkipped
  // blockquoteIsShort
  // altMissing
  // altNull
  // altMeaningless
  // altURL
  // altImageOf
  // altDeadspace
  // altLong
  // altPartOfLinkWithText
  var newResults = [];
  Ed11y.results.forEach((result) => {
    if (allowedTests.includes(result.test)) {
      newResults.push(result);
    }
  });
  Ed11y.results = newResults;

  let allDone = new CustomEvent('ed11yResume');
  document.dispatchEvent(allDone);

I'll be gone for a week or so, but @itmaybejj let me know if this is something you are interested in having in the Drupal module and I can work on getting a MR spun up.

Thanks for this great tool!

itmaybejj’s picture

Oh that's clever, and will work fine for the life of the 2.x branch. Sa11y does something similar, just embedded within the rulesets.

My vague plan has been to use an array like that, but reversed (disallowedTests), so that people would not need to update their settings when I added new tests and there wouldn't need to be as much data in drupalSettings.

nmillin’s picture

Gotcha. I like disallowedTests better.

I'm going to try and work on a MR for this functionality. By default, all tests would be enabled but individual tests could be disabled. I'll share when I have a rough working example. Thanks!

nmillin changed the visibility of the branch 3357207-disable-individual-tests to hidden.

nmillin changed the visibility of the branch 3357207- to hidden.

nmillin’s picture

Ok... https://git.drupalcode.org/project/editoria11y/-/merge_requests/20 is available for review. Let me know what you think.

A couple of things:

  1. I updated editoria11y.schema.yml, but I'm not sure that is needed.
  2. The admin form currently lists all of the machine names of the tests. I plan to update the label to the title from editoria11y-localization.js to have a more human friendly lable.
  3. I made code changes to the Library ed11y.js file so other platforms could leverage this too. The min version of that file would need to be updated (I didn't do that).

Thanks.

nmillin changed the visibility of the branch 3357207-Disable-individual-tests-via-gui-v2 to hidden.

nmillin changed the visibility of the branch 3357207-Disable-individual-tests-via-fui to hidden.

itmaybejj’s picture

Interesting. This might work.

I'm on assigned projects pretty much to the end of the month, and will be turning back to this March-ish.

nmillin’s picture

Sounds good!

I've pushed an update that updates the admin settings form to be human friendly labels. (It helps me better understand the tests too)

Let me know if you need anything from me (when you return to this). Thanks.

itmaybejj’s picture

Assigned: Unassigned » itmaybejj
Status: Postponed » Active
itmaybejj’s picture

Status: Active » Needs review

This looks fantastic to me. Thank you. Merging to test for next release...

  • itmaybejj committed f3be6742 on 2.2.x authored by nmillin
    Issue #3357207 by nmillin, itmaybejj: Disable individual tests via Admin...
nmillin’s picture

Great! Thanks.

itmaybejj’s picture

Status: Needs review » Reviewed & tested by the community
itmaybejj’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.