-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Four Kitchens Release - Sprint 40 #1415
Conversation
* fix(SHS-5134): fixing titles on colorbox galleries * fix(shs-5134): adjustments to aria-labels on galleries * fix(SHS-5134): removing custom data-cbox-img-attrs value * fix(shs-5134): simplifying alt attribute
* fix(shs-5150): fixing empty headings on grid views * fix(shs-5149): ensuring that empty card title tags are not printing * fix(shs-5149): removing unused code * fix(shs-5149): removing unused code * feat(shs-5149): add content heading check to date-stacked-vertical-card pattern --------- Co-authored-by: Andrés Díaz Soto <[email protected]>
…ype based on context (#1417) * feat(shs-4981): update labels for hs_carousel form and embedded paragraph types * feat(shs-4981): add use statement * feat(shs-4981): fix codeclimate issues * feat(shs-4981): check if array offsets exist before accessing them * fix(shs-4981): typo --------- Co-authored-by: Andrés Díaz Soto <[email protected]>
* fix(shs-5154): theming adjustments to layout builder forms * fix(shs-5154): close revision information details by default * fix(shs-5154): fixing code climate errors * fix(shs-5154): refining selector for revision info js --------- Co-authored-by: Andrés Díaz Soto <[email protected]>
/** | ||
* Implements hook_field_widget_single_element_WIDGET_TYPE_form_alter(). | ||
*/ | ||
function hs_paragraph_types_field_widget_single_element_paragraphs_form_alter(&$element, &$form_state, $context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$element
and $context
should be typehinted.
$form_state
is a FormStateInterface. It should be typehinted and doesn't need to be passed by reference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to hs_paragraph_types_field_widget_complete_paragraphs_form_alter
and fixed there
*/ | ||
function hs_paragraph_types_field_widget_single_element_paragraphs_form_alter(&$element, &$form_state, $context) { | ||
// Change the paragraph type label for hs_hero_image embedded in hs_carousel. | ||
if ($element['#paragraph_type'] === 'hs_hero_image' && $element['#bundle'] === 'hs_carousel') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for the triple =
here. Double is enough and is consistent with out normal code practice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
/** | ||
* Implements hook_field_widget_single_element_WIDGET_TYPE_form_alter(). | ||
*/ | ||
function hs_paragraph_types_field_widget_single_element_paragraphs_form_alter(&$element, &$form_state, $context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this to a hook_field_widget_complete_form_alter
. See the comment in the API documentation: https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/field/field.api.php?ref_type=heads#L231
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
// Change the add button label for field_hs_carousel_slides. | ||
if ( | ||
isset($field_widget_form['widget']['add_more']['add_more_button_hs_hero_image'], $field_widget_form['widget']['#field_name']) && | ||
$field_widget_form['widget']['#field_name'] === 'field_hs_carousel_slides' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for the triple =
here. Double is enough and is consistent with out normal code practice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
<div{{ attributes.addClass(classes) }}> | ||
{% if options.alignment == 'horizontal' %} | ||
{% for row in items %} | ||
<div{{ row.attributes.addClass(row_classes, options.row_class_default ? 'row-' ~ loop.index) }}> | ||
{% for column in row.content %} | ||
<div{{ column.attributes.addClass(col_classes, options.col_class_default ? 'col-' ~ loop.index) }}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the thoughts on changing this to <ul>
and <li>
elements? View results are typically lists and we should present that to screen readers as such.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pookmish Yes, this is definitely a good improvement and something we can check and implement in traditional and colorful themes. We'd prefer to keep this particular template as is, because the legacy theme is going to be phased out soon. We just added these templates to fix a specific a11y issue in mathematics, but the site will soon be migrated to one of the new themes.
@pookmish All issues fixed, ready for review. Thanks for the feedback! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's only one thing I want to verify.
foreach ($field_widget_form['widget'] as $key => $element) { | ||
// Only alter markup in field widget elements. | ||
if (!is_int($key)) { | ||
continue; | ||
} | ||
$element['top']['type']['label']['#markup'] = $new_label; | ||
$field_widget_form['widget'][$key] = $element; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you need to loop by reference if you want to change the label? &$element
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh now that i read it more closely, it would be alot better to loop by reference and remove line 57 entirely.
Also, a better way (and more consistent with core code) to loop on the keys is to use \Drupal\Core\Render\Element::children($field_widget_form['widget'])
. This will give you the keys and you can check for values in the arrays.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pookmish Fixed. PR is ready for review again.
… hs_carousel components
READY FOR REVIEW
Summary
Need Review By (Date)
12/15
Urgency
medium
Steps to Test
SHS-5149
https://chemistry.suhumsci.loc/people/lecturers
https://jewishstudies.suhumsci.loc/academics/awards-and-opportunities
https://mrc.suhumsci.loc/videos
https://francestanford.suhumsci.loc/project-area-study/humanities-arts
https://chemistry.stanford.edu/people/lecturers
https://jewishstudies.stanford.edu/academics/awards-and-opportunities
https://mrc.stanford.edu/videos
https://francestanford.stanford.edu/project-area-study/humanities-arts)
SHS-5150
Ensure there are no longer WAVE issues around empty heading tags printing on the following pages:
https://anthropology.suhumsci.loc/people/faculty-and-affiliates/faculty/leadership
https://dlcl.suhumsci.loc/people/faculty
https://shenlab.stanford.edu/people
Also check:
https://hs-traditional.suhumsci.loc/default-views/people
Please note that I have found one outlying issue that is noticeable in the traditional example. If the view returns "grouped" content, and it is grouped by a field that allows the user to select nothing, the field will print with comments inside the
<h3>
. I believe this will only happen live when logged in (I'm having trouble testing that since I can see template comments logged out locally.)SHS-5151
https://mathematics.stanford.edu/people/department-administration
SHS-5134
aria-title
attribute. This attribute should be (in this order): "Open [ALT TEXT] image in the gallery" if the alt text isn't blank, or generic text "Open image in the gallery" if neither of those exist.SHS-4981
hs_carousel
(Banner image(s) with text box) componentAdd Banner image with text box
hs_carousel
component have the textBanner image with text box
hs_hero_image
(Banner image with full overlay and text) componentBanner image with full overlay and text
SHS-5154
PR Checklist