Commit Graph

36 Commits

Author SHA1 Message Date
Andrea Fercia 2d60076e77 Accessibility: Improve the way emojis are announced by screen readers.
Adds an ARIA `role="img"` to the emojis markup in the front end. While the ARIA role is technically redundant, it helps Safari and VoiceOver to properly announce the emojis as "image". Without the role, they announce a generic "group" role.
Tested with Safari 12.1.1 / VoiceOver 9.

Props pento.
See #37486.

Built from https://develop.svn.wordpress.org/trunk@45726


git-svn-id: http://core.svn.wordpress.org/trunk@45537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-03 11:53:56 +00:00
atimmer 96bfb67e79 Docs: Improve JSDoc for `emoji.js`.
Props lisannekluitmans, hansjovisyoast, igorsch, nicollle.
Fixes #44367.

Built from https://develop.svn.wordpress.org/trunk@43360


git-svn-id: http://core.svn.wordpress.org/trunk@43188 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-06-28 02:35:44 +00:00
atimmer bde558be2f Docs: Add file doc `@output` annotations.
These annotations make it clear to the reader of a JavaScript source
where the build process outputs to. These annotations can later be
integrated in a webpack configuration. This way there is one source of
truth.

The `build` folder is omitted from the paths, because a single JS file
shouldn't not be responsible of knowing where outputs in general will
end up at. A file only knows its output location relative to the
project.

Props adamsilverstein, herregroen, omarreiss, pento.
Fixes #44361.

Built from https://develop.svn.wordpress.org/trunk@43347


git-svn-id: http://core.svn.wordpress.org/trunk@43175 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-06-28 02:30:15 +00:00
Dominik Schilling ea6e749c71 Emoji: Update the Twemoji loader to include the rainbow flag.
[38179] added support for the rainbow flag to core, but platform compatibility is a bit strange, because the flag was defined out of sync with the usual Unicode release cycle. For example Android N supports all Unicode 9.0 emoji, but doesn't support the rainbow flag thus the rainbow flag isn't rendered.
The Twemoji loader already has an exception for flags - it'll load if the browser supports everything but flags, and then only replace flag emoji, leaving everything else as native rendering. To provide a seamless experience for all flags the loader now uses the rainbow flag to test flag support.

Props pento.
See #37543.
Fixes #37566.
Built from https://develop.svn.wordpress.org/trunk@38194


git-svn-id: http://core.svn.wordpress.org/trunk@38135 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-04 20:51:31 +00:00
Peter Wilson 94290a843b Emoji: Use SVG in supported browsers
Use SVG images in supporting browsers, otherwise fall back to PNG images. Add the filters `emoji_svg_url` and `emoji_svg_ext`.

Introduces unit tests to check the Emoji CDN filters.

Fixes #36525

Built from https://develop.svn.wordpress.org/trunk@37471


git-svn-id: http://core.svn.wordpress.org/trunk@37439 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-20 06:03:27 +00:00
Andrew Ozz dee2f6ccb7 Fix typo in wp-emoji.js.
See #35977.
Built from https://develop.svn.wordpress.org/trunk@36981


git-svn-id: http://core.svn.wordpress.org/trunk@36948 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-13 20:30:27 +00:00
Gary Pendergast 5285483e6f Emoji: Fix some jshint warnings introduced in [36816].
See #35300.


Built from https://develop.svn.wordpress.org/trunk@36818


git-svn-id: http://core.svn.wordpress.org/trunk@36785 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-03 05:48:25 +00:00
Gary Pendergast 7803ae4cea Emoji: Add some extra IE11 compatibility.
IE 11's implementation of MutationObserver is buggy. It unnecessarily splits text nodes when it encounters a HTML template interpolation symbol ( "{{", for example ). So, we join the text nodes back together as a work-around.

Fixes #35977 for trunk.


Built from https://develop.svn.wordpress.org/trunk@36817


git-svn-id: http://core.svn.wordpress.org/trunk@36784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-03 05:21:26 +00:00
Gary Pendergast 2c277e3952 Emoji: Clean up the emoji browser support tests.
As new sets of emoji are added to Unicode, and browsers add support for them at random intervals, we'll inevitably need to add new tests to the emoji loader. This change makes it much easier to add new tests as they're needed.

Fixes #35300.


Built from https://develop.svn.wordpress.org/trunk@36816


git-svn-id: http://core.svn.wordpress.org/trunk@36783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-03-03 05:17:26 +00:00
Gary Pendergast 5a0f8ca847 Emoji: Add a test to the emoji loader, to see if the browser supports emoji diversity. If it doesn't, fall back to twemoji.
See #33592.


Built from https://develop.svn.wordpress.org/trunk@36160


git-svn-id: http://core.svn.wordpress.org/trunk@36126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-03 04:26:27 +00:00
Gary Pendergast 9974c9b18d Emoji: Ensure twemoji kicks in on certain DOM mutations.
Twemoji will replace the `img` with the emoji character, in the event that the image fails to load. We deliberately avoid trying to change that emoji character when it's changed back. We do need to replace emoji characters that are changed by something other than Twemoji, which this rectifies.

Fixes #34640.


Built from https://develop.svn.wordpress.org/trunk@35637


git-svn-id: http://core.svn.wordpress.org/trunk@35601 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-14 09:52:29 +00:00
Gary Pendergast d3f30288e9 Emoji: Use twemoji in browsers that don't support Unicode 8 emoji.
Some less advanced browsers are yet to add support for the important advances made in Unicode 8. Let's make ensure that their users can experience emoji in their full glory.

See #33592.


Built from https://develop.svn.wordpress.org/trunk@35606


git-svn-id: http://core.svn.wordpress.org/trunk@35570 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-11 02:25:25 +00:00
Drew Jaynes 5b34f6faff Add a true return description to the `test()` method added to wpEmoji in 4.3.
See [32335]. See #32891.

Built from https://develop.svn.wordpress.org/trunk@33203


git-svn-id: http://core.svn.wordpress.org/trunk@33175 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-13 17:59:24 +00:00
Andrew Ozz 4857824377 Update Twemoji to 1.4.1 including up to 3c0c13d3a5 (exclude SVG elements). Remove our hacks and adapt wp-emoji.js to use the new image attributes callback.
Fixes #32203.
Built from https://develop.svn.wordpress.org/trunk@32959


git-svn-id: http://core.svn.wordpress.org/trunk@32930 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-26 22:01:25 +00:00
Andrew Ozz 1c0419071f Emoji: make sure we parse only strings or DOM nodes that have children.
Props peterwilsoncc. Fixes #32300.
Built from https://develop.svn.wordpress.org/trunk@32679


git-svn-id: http://core.svn.wordpress.org/trunk@32649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-01 18:25:25 +00:00
Andrew Ozz 7ad60f3154 Emoji: do not try to replace emoji chars inside dynamic SVGs.
Fixes #32305 for trunk.
Built from https://develop.svn.wordpress.org/trunk@32478


git-svn-id: http://core.svn.wordpress.org/trunk@32448 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-09 23:44:27 +00:00
Andrew Ozz 67f589654b Emoji: add shorter/faster regex for testing for emoji chars in added nodes.
See #32125.
Built from https://develop.svn.wordpress.org/trunk@32347


git-svn-id: http://core.svn.wordpress.org/trunk@32318 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-05 01:41:27 +00:00
Andrew Ozz a5cee54aea Emoji: rename the exclude class to wp-exclude-emoji.
Props Clorith. See #32197.
Built from https://develop.svn.wordpress.org/trunk@32337


git-svn-id: http://core.svn.wordpress.org/trunk@32308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-04 00:05:28 +00:00
Andrew Ozz 8eb93bc838 Emoji: add an exclude class to wp-emoji checked when monitoring for changes with mutationObserver. Use it for the hidden div used for resizing the Text editor.
See #32197.
Built from https://develop.svn.wordpress.org/trunk@32336


git-svn-id: http://core.svn.wordpress.org/trunk@32307 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-03 20:18:26 +00:00
Andrew Ozz 86674d41af Emoji: before parsing added nodes test if the text in them contains emoji chars. That speeds up the processing quite a bit.
See #32125.
Built from https://develop.svn.wordpress.org/trunk@32335


git-svn-id: http://core.svn.wordpress.org/trunk@32306 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-03 19:08:24 +00:00
Andrew Ozz 4e971bea9f Emoji:
- Fix loading errors in IE9 and IE10.
- Add fallbacks for the loading events.
Fixes #32109 for trunk.
Built from https://develop.svn.wordpress.org/trunk@32334


git-svn-id: http://core.svn.wordpress.org/trunk@32305 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-03 18:45:29 +00:00
Andrew Ozz 01c26527ea Emoji: fix loop when replacement images fail to load.
Props iseulde. Fixes #32128 for trunk.
Built from https://develop.svn.wordpress.org/trunk@32323


git-svn-id: http://core.svn.wordpress.org/trunk@32294 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-29 03:19:26 +00:00
Gary Pendergast 5ab25275a7 Emoji: Remove an errant `/` in Twemoji URLs.
Props tmatsuur.

Fixes #31893.


Built from https://develop.svn.wordpress.org/trunk@32024


git-svn-id: http://core.svn.wordpress.org/trunk@32003 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-05 07:28:26 +00:00
Andrew Ozz e053979219 Emoji:
- Enhance twemoji.js to support passing of additional attributes for the replacement images.
- Use that to add the needed attributes when replacing emoji inside the editor.
Fixes #31627.
Built from https://develop.svn.wordpress.org/trunk@31948


git-svn-id: http://core.svn.wordpress.org/trunk@31927 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-01 02:39:28 +00:00
Andrew Ozz 62c3c1d798 Fix initialization of wp-emoji in IE8.
Props pento, azaozz. Fixes #31701.
Built from https://develop.svn.wordpress.org/trunk@31898


git-svn-id: http://core.svn.wordpress.org/trunk@31877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-26 02:40:28 +00:00
Gary Pendergast b53b12ff8c Emoji: Instead of loading the emoji JS files automatically, we now include a small JS shim in the header, to test if the user's browser needs Twemoji. It then loads the emoji JS files only if they're needed.
Props pento, azaozz.

Fixes #31701.


Built from https://develop.svn.wordpress.org/trunk@31875


git-svn-id: http://core.svn.wordpress.org/trunk@31854 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-24 23:33:32 +00:00
Gary Pendergast 01fd948b90 Emoji: The regex for checking if the current glyph is a flag was checking the incorrect byte range, which was causing the South Korean flag to not be replaced in Firefox.
Built from https://develop.svn.wordpress.org/trunk@31869


git-svn-id: http://core.svn.wordpress.org/trunk@31848 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-24 09:58:28 +00:00
Gary Pendergast faac51cad0 Emoji: Move a comment to match the restructure in [31779], and add an extra comment explaining how emoji rendering support is detected.
See #31242


Built from https://develop.svn.wordpress.org/trunk@31788


git-svn-id: http://core.svn.wordpress.org/trunk@31768 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-16 00:06:28 +00:00
Andrew Ozz c18ef513a0 Emoji: fix few typos. See #31242.
Built from https://develop.svn.wordpress.org/trunk@31787


git-svn-id: http://core.svn.wordpress.org/trunk@31767 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-15 23:29:26 +00:00
Andrew Ozz a7fd4a3774 Emoji:
- Add the styling for the replacement images to the admin CSS.
- Revert to using `.emoji` as replacement image class.
- When pasting in the editor, convert emoji images to our format so we can replace them with chars on saving.
- Some more clean up of both the plugin and wp-emoji.js.
See #31242.
Built from https://develop.svn.wordpress.org/trunk@31786


git-svn-id: http://core.svn.wordpress.org/trunk@31766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-15 23:16:29 +00:00
Andrew Ozz 1fc8c98fd7 Emoji: always export the methods in wp-emoji.js, even when dependencies are missing and we cannot initialize.
See #31242.
Built from https://develop.svn.wordpress.org/trunk@31780


git-svn-id: http://core.svn.wordpress.org/trunk@31760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-15 00:17:27 +00:00
Andrew Ozz 8a402aa701 Emoji:
- Move the TinyMCE plugin CSS to wp-content.css.
- Change the replacement images class to `wp-emoji` inside the editor.
- Clean up both the plugin and wp-emoji.js, abstract and restructure a bit.
See #31242.
Built from https://develop.svn.wordpress.org/trunk@31779


git-svn-id: http://core.svn.wordpress.org/trunk@31759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-14 23:49:30 +00:00
Andrew Ozz c8129335b5 Emoji: better regex when testing for only char emoji. Props iseulde. See #31242.
Built from https://develop.svn.wordpress.org/trunk@31772


git-svn-id: http://core.svn.wordpress.org/trunk@31752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-13 20:27:26 +00:00
Andrew Ozz e7131def4d Emoji:
- Patch twemoji.js to prevent infinite loop.
- Fix some `undefined` errors in old IE.
Props iseulde. See #31242.
Built from https://develop.svn.wordpress.org/trunk@31756


git-svn-id: http://core.svn.wordpress.org/trunk@31737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-12 19:53:26 +00:00
Gary Pendergast b7546d798f Emoji: Instead of having custom hooks for Ajax callbacks, use MutationObserver to re-parse any changed elements in the DOM.
Props iseulde

See #31242


Built from https://develop.svn.wordpress.org/trunk@31750


git-svn-id: http://core.svn.wordpress.org/trunk@31731 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-12 12:52:26 +00:00
Andrew Nacin 78679bfb3f Emoji JS cleanup.
* Filename: emoji.js => wp-emoji.js
 * Script handle: emoji => wp-emoji
 * Object: WPEmoji => wp.emoji
 * Script settings: EmojiSettings => _wpemojiSettings
 * Setting key: base_url => baseUrl
 * Remove executable bit from files

see #31242.

Built from https://develop.svn.wordpress.org/trunk@31744


git-svn-id: http://core.svn.wordpress.org/trunk@31725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-12 03:17:26 +00:00