[wp-trac] [WordPress Trac] #54208: Social icons have duplicate height and width values

WordPress Trac noreply at wordpress.org
Fri Oct 1 13:45:48 UTC 2021


#54208: Social icons have duplicate height and width values
---------------------------+-----------------------------
 Reporter:  Max dAyala     |      Owner:  (none)
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Bundled Theme  |    Version:  5.8.1
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 This applies to the twenty twenty-one bundled theme.

 Refer to the class:
  Twenty_Twenty_One_SVG_Icons

 in the file:
  class-twenty-twenty-one-icons.php

 The header of the file says that the svg icons should not have a height or
 width specified. This is because the height and width are added later by
 the get_svg() function.

 The social icons, however, have the height and width specified in the svg
 definitions. This means that the height and width attributes end up
 appearing twice in the final string representing the svg element. This is
 obviously invalid XML, although browsers will still parse it.

 Here is example output obtained from viewing the source of a web page in
 the browser:


 {{{
 <svg class="svg-icon" width="24" height="24" aria-hidden="true" role="img"
 focusable="false" width="24" height="24" viewBox="0 0 24 24" version="1.1"
 xmlns="http://www.w3.org/2000/svg">
 }}}



 Note that the user interface icons in the same source file do not have the
 height and width specified. These appear to be correct.

 Hence, unless there is a good reason not to, the height and width should
 be removed from the social icon svg definitions to avoid confusion and
 potential problems when people create child or custom themes based on
 these svg definitions.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54208>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list