Panopoly Magic redoes the vanilla Add Content dialog that's provided by the CTools/Panels/IPE. Instead of having the widget label be a link, Magic creates an "Add" link and styles it to look like a button. The Add link doesn't have any additional text to say what the link does out of context. This makes it impossible for a screenreader user to know what they'll add when they click the link. It also makes it harder to do automated testing of different widget types. If you use a When I click "Add" step, you'll only ever be able to click the first instance.

Adding invisible text including the widget label should fix both problems.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cboyden created an issue. See original summary.

cboyden’s picture

Adding invisible text is easy enough. However, making this change will the break button styling in Radix or in any theme that uses a similar approach in hook_preprocess_panels_add_content_link. The function depends on the title exactly matching t('Add').

cboyden’s picture

Assigned: cboyden » Unassigned
Status: Active » Needs review
Related issues: +#2773717: Theming for Add Content links depends on exact title text match
FileSize
699 bytes

Here's a patch that adds invisible text to the Add link. See related issue #2773717: Theming for Add Content links depends on exact title text match in Radix for work on a fix for button styling.

dsnopek’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

The Panopoly code looks fine!

However, considering the Radix issue (and my comment there) it might make sense to also stash some additional information on the $content_type array, for example, (a) flag to indicate that this is an add button, or (b) the original title text so that we can reconstruct the translated title on the Radix end (but that's really just to determine if this is an add button, so doing (a) is cleaner).

It'd also be really great to have a Behat test that takes advantage of this - there might be an existing Behat test that's doing something wonky to work around not being able to target a specific 'Add' button that we can just modify, or if not, create a new test scenario with the others that test the previews in the "Add content" modal.

cboyden’s picture

Status: Needs work » Needs review
FileSize
753 bytes
656 bytes

Thanks, I've updated the patch to add a flag to the array that can then be used by themes to know that this is a panopoly_magic Add button.

There are no tests with an I click "Add" step. I assume that means there are as yet no Behat tests that use the IPE to add any type of content other than the top-level widgets provided by Panopoly itself.

dsnopek’s picture

The code looks great! This is just waiting on a Behat test, and then I think it's ready to commit. :-)

cboyden’s picture

Here's a patch for panopoly_test that adds a scenario to check that the link text in the Add button contains the widget title.

dsnopek’s picture

dsnopek’s picture

FileSize
1.99 KB
1.01 KB

An old test that looked at (but didn't click) the "Add" buttons failed - here's an updated panopoly_test patch to fix it!

EDIT: Here's the Travis build: https://travis-ci.org/panopoly/panopoly/builds/148287721

  • dsnopek committed 95ae976 on 7.x-1.x
    Update Panopoly Magic and Test for Issue #2773683 by cboyden, dsnopek:...
dsnopek’s picture

Status: Needs review » Fixed
Issue tags: -Needs tests

Tests passed, so, committed! Thanks!

Status: Fixed » Closed (fixed)

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