<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Tomek Niezurawski on Medium]]></title>
        <description><![CDATA[Stories by Tomek Niezurawski on Medium]]></description>
        <link>https://medium.com/@tomekdev?source=rss-ad47e06ba29e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*k8QNczNIAbY2Im_POinrAA.jpeg</url>
            <title>Stories by Tomek Niezurawski on Medium</title>
            <link>https://medium.com/@tomekdev?source=rss-ad47e06ba29e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 05:26:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tomekdev/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Feature flags: bad practices]]></title>
            <link>https://nothingventured.rocks/feature-flags-bad-practices-6f4a61842ef2?source=rss-ad47e06ba29e------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f4a61842ef2</guid>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[feature-flagging]]></category>
            <category><![CDATA[product-development]]></category>
            <category><![CDATA[feature-flags]]></category>
            <dc:creator><![CDATA[Tomek Niezurawski]]></dc:creator>
            <pubDate>Mon, 05 Jul 2021 13:45:17 GMT</pubDate>
            <atom:updated>2021-07-05T13:45:17.095Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E2y0bVN4D8AG8ygaxs4Uzg@2x.png" /></figure><p>Feature flags are in our DNA now. I don’t remember how we were rolling out complex features before. But this is a pretty advanced technique and one can run into traps.</p><p>Let’s go through bad practices and learn something from them.</p><h3>I cry when feature flags don’t want to die</h3><p>That’s the biggest managerial mistake I see. <strong>Feature flags have to end their life. </strong>But sometimes developers are asked to show a certain feature only to a group of users.</p><p>Be careful! That might be a trap!</p><p>If someone asks you to show a feature to “power users” (e.g. support) or only to users from a certain region (say, only the French market) then there is a high chance that you don’t have a rollout plan.<br>It’s a sign that <strong>your software is missing some general features</strong> like roles, user settings, packages/tiers, or something similar.</p><p>Don’t use feature flags for stuff like this because you’ll end up with them till the end of the project. Which will add complexity to the codebase and blur the overview of features rollout.</p><h3>No clear picture of the rollout</h3><p>It’s important to keep an eye on all flags and their lifecycle. At Phorest we have a few stages for a flag:</p><ul><li>Not activated yet — no one sees it,</li><li>Internal Release — support, onboarding, and sales get familiar with the feature,</li><li>Beta Release — a list of clients, a region or 5% of our userbase,</li><li>Public Release — 100% of our clients,</li><li>To remove from code — some time after Public Release we can remove it from code to simplify the codebase,</li><li>To archive — we remove it completely from the software we use.</li></ul><p>If you don’t have a clear overview then it’s easy for a flag to get stuck in the process. Most often, they get stuck after Public Release when everyone opened champagnes and started the celebration.</p><p>It’s our job, as developers, to finish the process and <strong>reduce the complexity of the codebase</strong>. In our case, it happens weeks after complete rollout when we are sure everyone gets the same variation of a flag.</p><h3>Developers responsible for the whole process</h3><p>Look back at the previous section. We have 6 stages of the rollout but only 3 of them involve developers. That’s a healthy situation.</p><p><strong>A bad practice is to leave feature flags only with the engineering team.</strong> That’s a no-no. If you want to truly leverage from Feature Flags you have to have a product or managerial people involved. Otherwise, it’s not going to be a part of the company’s culture. It’s just going to be another dev thing that devs do.</p><p><strong>Product Owners&#39; knowledge about features is more holistic!</strong> Can we ship it to everyone? Well, do you have all the translations? Do we have articles written for help pages? Is our support aware or we will say “hello! surprise!”? Do salespeople know what they are selling? Are the marketing materials ready? Etc…</p><p>Imagine a happy developer having to deal with all of that ⬆️.</p><h3>Being afraid of code duplication</h3><p>As developers, we all believe in DRY (Don’t Repeat Yourself) and our IDEs get crazy when they see code duplication. But avoiding duplication is not always desired with feature flags.</p><p><strong>By its nature, this is a temporary solution.</strong> Flags have to end their life and we need to make some clean-up.</p><p>If you see that introducing a flag would create a huge number of if-else statements then consider code duplication. It will be easier to maintain and remove the flag. <br>Say you have a component.js that does something. If introducing a flag increases the complexity of code significantly then you should rather copy the code and introduce component-v2.js .<br>At the time you’ll be removing the flag you just have to delete component.js and rename component-v2.js. Much much easier than going through if-else soup.</p><h3>Not thinking about the removal process</h3><p>It’s a bit connected with the section above. When you introduce a flag and make the code changes <strong>you have all the context about it</strong>. <br>You won’t have it in a few months from now when you’ll be removing it. Neither someone else.</p><p>Make yourself a favor and right after introducing a flag, create another PR that removes it. Sure, in a few months you’ll have to rebase it. Maybe resolve some conflicts. But the majority of the work will be done. Some memory anchors will trigger and that will make the process easier.</p><p>So <strong>raise a flag removal Pull Request</strong> when introducing one.</p><h3>Mixing flag logic with application logic</h3><p>As you see, code duplication is allowed. The removal process is taken into account. So to complement this way of thinking we must say that mixing flag logic with application logic is a bad practice.</p><p>Instead of code like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5475e61e53e35e64a104c05d1d7b39d2/href">https://medium.com/media/5475e61e53e35e64a104c05d1d7b39d2/href</a></iframe><p>Prefer this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2414fd37e06b5fb8a9f086f93bc8570b/href">https://medium.com/media/2414fd37e06b5fb8a9f086f93bc8570b/href</a></iframe><p>Yes, it’s more lines of code but so much easier to remove and reason about. We just need to remove one if without analyzing how it’s going to affect the business logic.</p><h3>Introducing a flag in too many places</h3><p>You see the pattern, don’t you? It’s all about easy removal as the thing is temporal. Introducing a flag in too many places is a bad practice. You should think a little bit about <strong>the right place</strong> for a flag that<strong> will serve as a gate</strong>.</p><p>For example, you guard the whole route that is not accessible for people without the flag instead of adding it to almost every component that is on that page.</p><h3>Adding “disabling” feature flags</h3><p>Feature flags should always switch the functionality ON. You should not mix the logic here and add flags that switch something off when they are on. It doesn’t make sense when I wrote it down, right? But look at the examples below, it’s quite easy to run into that trap.</p><p>Say you add a discounts feature and you want to get the proper price from the resource that holds prices. You could do this, <strong>which is bad</strong>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/db68b85fe977078775995ae7ce9afa02/href">https://medium.com/media/db68b85fe977078775995ae7ce9afa02/href</a></iframe><p>Instead, prefer this — <strong>always enabling</strong>:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ecf69656d7d09ebf63cf74996e8a31f4/href">https://medium.com/media/ecf69656d7d09ebf63cf74996e8a31f4/href</a></iframe><h3>Summary</h3><p>To summarize, you should have a plan for a feature rollout and how to kill the flag. <strong>Make the killing as easy as possible</strong> through code duplication, not mixing flags with business logic, raising a PR with removal when you have a context, and thinking what’s the best place for them in your code.</p><p>Be afraid when flags are used to cover the lack of functionality in your software. And <strong>remember, that’s not a dev thing!</strong></p><p><a href="https://twitter.com/tomekdev_"><em>Tomek Nieżurawski</em></a><em> writes also on his own blog — </em><a href="https://tomekdev.com/"><em>tomekdev.com</em></a><em>.</em></p><p><em>We are always looking to speak to amazing engineers about joining the Phorest team. You can check out open roles </em><a href="https://www.phorest.com/about/careers/"><em>here</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f4a61842ef2" width="1" height="1" alt=""><hr><p><a href="https://nothingventured.rocks/feature-flags-bad-practices-6f4a61842ef2">Feature flags: bad practices</a> was originally published in <a href="https://nothingventured.rocks/">Nothing Ventured</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MJML for email is what React Native is for mobile]]></title>
            <link>https://nothingventured.rocks/mjml-for-email-is-what-react-native-is-for-mobile-9579612b57e8?source=rss-ad47e06ba29e------2</link>
            <guid isPermaLink="false">https://medium.com/p/9579612b57e8</guid>
            <category><![CDATA[email]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[email-development]]></category>
            <category><![CDATA[mjml]]></category>
            <dc:creator><![CDATA[Tomek Niezurawski]]></dc:creator>
            <pubDate>Tue, 20 Apr 2021 08:23:00 GMT</pubDate>
            <atom:updated>2021-04-20T09:34:00.138Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Woman in front with opened mail behind. Mail is surrounded with icons representing rich emails with gifts, charts, media, etc." src="https://cdn-images-1.medium.com/max/1024/1*6PrVaihYqYa43wgGy4--Pw@2x.png" /></figure><p>React Native has changed the way we do mobile apps. <a href="https://nothingventured.rocks/react-native-is-worth-its-weight-in-gold-here-at-phorest-a63565cb0063">We absolutely love it</a>. But there is another technology that deserves an award.</p><p>It’s MJML by Mailjet.</p><h3>Email tech is bad</h3><p>I don’t know a front-end dev who enjoys creating templates for emails (<a href="https://www.reddit.com/r/Frontend/comments/holb6c/i_hate_email_development/">they rather hate it</a>). It’s just the dark ages again. There are many poorly written email client engines in the wild (e.g. <em>Microsoft Outlook) </em>and that’s even worse than browsers in the hardcore times of IE6–9.</p><p>Look at the advert below:</p><figure><img alt="Litmus advertisement saying: “No more broken emails with Litmus Email Previews. Preview your email across 90+ email clients, apps, and devices to ensure an onboard, error-free subscriber experience.”" src="https://cdn-images-1.medium.com/max/1024/1*mDwmKDqk74v9m_J8f2Hg0w.png" /><figcaption>90+ environments!? 🙀</figcaption></figure><p>This is how a popular email testing service advertises itself. When they say there are many email clients they really mean it.</p><h3>Styling is a nightmare</h3><p>Do you want the layout to look nice? You have to use &lt;table&gt;. <br>Responsive? Well… better put the whole layout in 600px wide box and do responsiveness through tables. <br>Global styles? Nah, put everything inline. <br>Showing images in a nice way? We shouldn’t even start this conversation.</p><p>Yes. It’s just difficult with a lot of quirks and you can forget about modern development with semantic approach etc.</p><h3>But there is a solution</h3><p>Or even better “the solution”! MJML is a component-based framework (finally a modern buzzword 😏) and folks from Mailjet <a href="https://github.com/mjmlio/mjml">open-sourced it</a>.</p><p>The premise is “<em>Write less, save time, and code more efficiently</em>” and we found that being accurate. The component approach makes a lot of sense here. Instead of trying to make the whole email layout perfect, they try to provide a perfect implementation of bricks like a button, divider, image, column, row, or even a carousel! In an email!</p><figure><img alt="Example of carousel in email. One main image and three thumbnails below." src="https://cdn-images-1.medium.com/max/1024/1*ZCn6_3NiogXs73DZTHtgaA.png" /><figcaption>(Interactive) Carousel in an email. I’m not a huge fan of carousels but the fact it’s doable in an email makes it attractive to me.</figcaption></figure><p>Perfect bricks are not a guarantee of a perfect email implementation but it increases the chances for one. <a href="https://documentation.mjml.io/">The documentation</a> is pretty cool as well so we recommend giving it a try!</p><h3>We don’t use it in a typical way</h3><p>When it comes to us, it’s not about sending emails to our clients. <strong>It’s about our clients sending emails to their clients.</strong></p><p>We aim to provide salon owners not only with software to manage their salons but to also run marketing campaigns and appearance/brand online.<br><strong>So we created an email editor for them</strong>. With lots of templates ready to use that cover topics around the hair&amp;beauty industry, as well as for special occasions like client birthday, before Christmas fever, Black Friday, etc.</p><p>MJML lets us do it in a very predictive way. We can (kind of) follow their documentation and convert options into interactive elements. Like here with adjusting button’s appearance:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F538149907%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F538149907&amp;image=http%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F1114041951_1280.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1284" frameborder="0" scrolling="no"><a href="https://medium.com/media/96aca7d7fb9ff0d7ed98bdc3b01fcc92/href">https://medium.com/media/96aca7d7fb9ff0d7ed98bdc3b01fcc92/href</a></iframe><p>We operate on a set of defined properties and then it is translated to real HTML via the MJML library. Speaking of the button from the video, take a look at generated markup <strong>and CSS:</strong></p><figure><img alt="Screenshot of dev tools showing non-obvious styling for a button within an email." src="https://cdn-images-1.medium.com/max/1024/1*H09Ux6pAn1xXP58vX0TtTQ.png" /></figure><p>That’s a lot of inline styles to make sure a button looks ok, but would you ever thought of setting mso-padding-alt? <strong>I would not.</strong><br>It’s a declaration of an alternative style for Microsoft Outlook and I can only imagine how much of a hassle it can produce.</p><p>But we don’t have to worry about it.</p><h3>Hey, it’s responsive! 🎉</h3><p>Can you imagine how many people use their phones when commuting or sitting in a waiting room? Well, we probably use phones everywhere and probably too often. So it’s not a surprise that they read email on smaller screens.</p><p>It’s super important for us to provide responsiveness to the emails our clients send. In the majority of cases, they are not aware of responsiveness, mobile-first, and how many pixels we have for our disposal. <strong>We need to do it for them</strong>.</p><p>MJML again helps us a lot with that. Take a look at our real email previews:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F538167867%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F538167867&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F1114085461_1280.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1920" height="1405" frameborder="0" scrolling="no"><a href="https://medium.com/media/297864f3b3abc9fb7b54b89030dff011/href">https://medium.com/media/297864f3b3abc9fb7b54b89030dff011/href</a></iframe><p>The main image gets re-scaled nicely, column layouts get into individual rows, everything is readable without our users even knowing how to do that.</p><p>That’s not a crazy difficult layout for web standards but it can be a headache for email.</p><h3>Summary</h3><p>That only scratches the surface of our email editor’s functionality but we know that all the goodies would not be possible without MJML. It would cost us much more work and lots of trials and errors.</p><p>Despite our advanced use case, <strong>next time you have to cover email templating </strong>in your application give <a href="https://github.com/mjmlio/mjml">MJML</a> a try. You won’t regret it 💌.</p><p><a href="https://twitter.com/tomekdev_"><em>Tomek Nieżurawski</em></a><em> writes also on his own blog — </em><a href="https://tomekdev.com/"><em>tomekdev.com</em></a><em>.</em></p><p><em>We are always looking to speak to amazing engineers about joining the Phorest team. You can check out open roles </em><a href="https://www.phorest.com/about/careers/"><em>here</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9579612b57e8" width="1" height="1" alt=""><hr><p><a href="https://nothingventured.rocks/mjml-for-email-is-what-react-native-is-for-mobile-9579612b57e8">MJML for email is what React Native is for mobile</a> was originally published in <a href="https://nothingventured.rocks/">Nothing Ventured</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Anchors for headings in MDX]]></title>
            <link>https://tomekdev.medium.com/anchors-for-headings-in-mdx-8597850b8064?source=rss-ad47e06ba29e------2</link>
            <guid isPermaLink="false">https://medium.com/p/8597850b8064</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[mdx]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Tomek Niezurawski]]></dc:creator>
            <pubDate>Sun, 07 Feb 2021 00:00:00 GMT</pubDate>
            <atom:updated>2021-02-09T22:09:29.502Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9l89JpPhPg7b4TeBTSB2YA.png" /></figure><p><em>This post was originally published on </em><a href="https://tomekdev.com/posts/anchors-for-headings-in-mdx"><em>https://tomekdev.com/posts/anchors-for-headings-in-mdx</em></a><em>. What you see as GIF here is interactive there.</em> ✌️</p><p>How to add anchors to headings in MDX? It’s surprisingly easy to do. I assume you are already familiar with MDX so somewhere in your code you should have a blog page layout component that uses &lt;MDXProvider&gt;, like that:</p><p>MDX consists of components itself. So if there is a code like this then the interpreter changes the inner value (children) into the same content but wrapped with &lt;code&gt;&lt;/code&gt;.</p><p>The same applies to all the headings, lists, paragraphs, etc. Our job is to override the headings. We can do it by passing components hash and specifying a replacement.</p><pre>import H2 from &#39;./MyCustomMDX/H2&#39;;<br>import H3 from &#39;./MyCustomMDX/H3&#39;;<br>import H4 from &#39;./MyCustomMDX/H4&#39;;<br><br>// ...<br><br>&lt;MDXProvider<br>  components={{<br>    h2: H2,<br>    h3: H3,<br>    h4: H4,<br>  }}<br>&gt;<br>  {children}<br>&lt;/MDXProvider&gt;;</pre><p>Please notice that we are not going to add an anchor to the &lt;h1&gt; tag. It doesn&#39;t make sense in my opinion. &lt;h1&gt; is like a summary of the whole page. The URL that links to it is the direct link to the post. Anchors should be used to specific parts of a post (to a section).</p><h3>Override heading component</h3><p>The override for &lt;h2&gt; that shows an anchor when the mouse is over the text could look like this:</p><pre>// ./MyCustomMDX/H2.js<br><br>function getAnchor(text) {<br>  return text<br>    .toLowerCase()<br>    .replace(/[^a-z0-9]/g, &#39;&#39;)<br>    .replace(/[]/g, &#39;-&#39;);<br>}<br><br>const H2 = ({ children }) =&gt; {<br>  const anchor = getAnchor(children);<br>  const link = `#${anchor}`;<br>  return (<br>    &lt;h2 id={anchor}&gt;<br>      &lt;a href={link} className=&quot;anchor-link&quot;&gt;<br>        §<br>      &lt;/a&gt;<br>      {children}<br>    &lt;/h2&gt;<br>  );<br>};<br><br>export default H2;</pre><p>Below you’ll see the demo. Please notice the hover state. On the left you should see § sign that is also a link, representing our anchor:</p><figure><img alt="Anchor demo — show on hover" src="https://cdn-images-1.medium.com/max/653/1*pxsxpXyiZMcbfWat-p2Y7g.gif" /><figcaption>Anchor demo — show on hover</figcaption></figure><p>Let’s explain a few bits. The way we use headings in Markdown is by using # sign, for example:</p><pre>## I&#39;m h2 with an anchor</pre><p>Everything that goes after ## is passed as a child to the H2 component.</p><p>So the next interesting bit is done in the getAnchor function. Take a look at lines 3 to 8. This is what happens:</p><ul><li>line 5 — we convert the input to lower case → “i’m h2 with an anchor”</li><li>line 6 — we remove all non-alphanumeric characters → “im h2 with an anchor”</li><li>line 7 — we replace spaces with a hyphen → “im-h2-with-an-anchor”</li></ul><p>… and voilà. We have a URL-friendly anchor 🎉</p><h3>The styling</h3><p>Another important thing here is the CSS. We want to show the anchor only on hover and somewhere next to the heading itself:</p><pre>h2 {<br>  position: relative;<br>}</pre><pre>.anchor-link {<br>  color: #666;<br>  opacity: 0;<br>  position: absolute;<br>  transform: translate(-1em, -2px);<br>  width: 1em;<br>}</pre><pre>h2:hover .anchor-link {<br>  opacity: 1;<br>}</pre><p>Of course, you can go crazy with your anchors ;) That one is very basic.</p><h3>Recommendation</h3><p>One thing that is easy to overlook here (in my example) is using a character like § inside of &lt;h2&gt; tag. In this approach, <strong>the sign will become a part of the document outline</strong>. Which is not something we want. It&#39;s better to use an icon in SVG format for example but I didn&#39;t want to complicate the example.</p><p>If the simple sign is what you want then you should render &lt;a&gt; tag before or after the &lt;h2&gt;.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8597850b8064" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Alignment meetings]]></title>
            <link>https://nothingventured.rocks/alignment-meetings-acce06fefb62?source=rss-ad47e06ba29e------2</link>
            <guid isPermaLink="false">https://medium.com/p/acce06fefb62</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[meetings]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ember]]></category>
            <category><![CDATA[quality]]></category>
            <dc:creator><![CDATA[Tomek Niezurawski]]></dc:creator>
            <pubDate>Mon, 11 Jan 2021 14:26:24 GMT</pubDate>
            <atom:updated>2021-01-11T14:26:24.086Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="A bunch of people is adding Alignment meeting to a calendar. Instead of a regular cross icon they use Tomster’s face." src="https://cdn-images-1.medium.com/max/1024/1*EjgjfJEdw7fXeppULogBGg.png" /></figure><p>We are getting very religious about it but we love our bi-weekly Alignment meetings so much that we have to share a few words about it.</p><h3>Who enjoys meetings?</h3><p>Once a sprint, in the first week of work we gather <strong>all our front-end developers</strong> for an hour and talk about stuff that connects all our tribes (teams): Ember and front-end codebase.</p><p>I’ve never seen developers so happy for a meeting. Well, I’ve seen them happy about a meeting <em>but only when it was canceled</em> 🤭.</p><figure><img alt="Random messages from slack channel where developers share their excitement about upcoming meeting" src="https://cdn-images-1.medium.com/max/1024/1*Wd54YWkaVc2pWHJepcaxkA.png" /><figcaption>A rare occasion to see devs happy for a meeting</figcaption></figure><h3>What do we do?</h3><p>We talk about new components for general use that someone introduced, we talk about problems and possible solutions, we talk about migrating from one pattern to the other, removing dependencies, useful techniques… and so on (examples below):</p><p>In general, we can divide it into three categories:</p><ul><li>Issues we should discuss</li><li>New stuff we should know about</li><li>Other cool stuff</li></ul><p>When it comes to technicals, we do set an agenda. <strong>That’s a good rule for any meeting.</strong> If a discussion is not moderated then we might end up talking for 45 minutes about something unrelated. But there is no-one who’s approving the agenda. We just pop in cards as we go through the sprint. So everyone’s voice should be heard.</p><p>All that divided into four columns:</p><figure><img alt="Ember Alignment board with four columns: Next Meeting Agenda, Actions, In Progress and Done." src="https://cdn-images-1.medium.com/max/1024/1*RDq6F1nqQjNoOmAkVo0hAQ.png" /></figure><h3>How it looks from the inside</h3><p>It’s easier to understand the excitement when you see examples. So here is the stuff that we discussed in the past. Along with some decisions that we’ve made. <strong>In many cases these are the topics that Product Managers won’t ask you about</strong>:</p><figure><img alt="Trello card with text: “Lingohub will create a PR every Monday at 8:00 IST”" src="https://cdn-images-1.medium.com/max/1024/1*zczm2TjAsW-_QlKYhmrOHA.png" /></figure><p>1/ We use Lingohub as a repository of translations so we have to merge a pull request with them from time to time.<br>Here, <strong>other folks were informed</strong> we have automated that process.</p><figure><img alt="Trello card with text: “Shall we agree on where we stand on the mut helper and it’s future in our codebase?”" src="https://cdn-images-1.medium.com/max/1024/1*XyHzsWoik0_8t2HvgsGnKQ.png" /></figure><p>2/ <strong>We discuss patterns that we should use in our codebase</strong>. In Ember’s world mut helps in setting the value of a variable (or property) straight from a template. There are a few ways of doing that with pros and cons for each. It’s important that we have a common understanding and a common approach.</p><figure><img alt="Trello card with text: “UI Rich Text Editor”" src="https://cdn-images-1.medium.com/max/1024/1*GmDZWMINuensJ2tau6d0PA.png" /></figure><p>3/ <strong>A new component has been introduced</strong>. With increasing customization of the product, we found a need for a Rich Text editor component that can be used everywhere. Jonny and Rafa were showing how it works <strong>in our Styleguide</strong> (<a href="https://github.com/chrislopresto/ember-freestyle">we use ember-freestyle</a>). We try to build components for general use in the Styleguide to not be biased by the specific needs for a solution we are currently working on.</p><figure><img alt="Trello card with text: “Do we need to target all those browsers?”" src="https://cdn-images-1.medium.com/max/1024/1*tmPy3uGfL1MD-zew_3D_Sw.png" /></figure><p>4/ The other day we revisited the minimal requirements for our application. We can easily cut a few bytes by transpiling the code only for more modern browsers. After discussion, and verifying what users actually use we’ve made a decision.</p><figure><img alt="Trello card with text: “Standardisation of z-index”" src="https://cdn-images-1.medium.com/max/1024/1*vrwYgUhZuBWZQ1eimT_IQg.png" /></figure><p>5/ Our product is getting bigger and bigger. <strong>We need to understand how UI elements lay on the stack.</strong> We want to make sure that error messages are always shown at the top, or a dropdown is going to be covered by a sliding panel for example.<br>We came up with an idea of a single file with all z-indexes as CSS variables that we use in different places. When you look at the file, you see the whole stack.</p><figure><img alt="Trello card with text: “Using traits and after create in tests”" src="https://cdn-images-1.medium.com/max/1024/1*vfQH68gL1s-F2DsVe0IdNg.png" /></figure><p>6/ <strong>Short presentation</strong> about traits and afterCreate in <a href="https://www.ember-cli-mirage.com/">ember-cli-mirage</a> and how we are going to leverage that functionality. We all agreed it’s helpful and the way to go for us.</p><figure><img alt="Trello card with text: “LogRocket experiment”" src="https://cdn-images-1.medium.com/max/1024/1*TjZcYa66rxaldvWYWkilPA.png" /></figure><p>7/ <strong>Conclusions from the experiments</strong> with LogRocket. How it works, how we can benefit from that, what’s our estimated cost etc.</p><figure><img alt="Trello card with text: “Conditional wrapper technique”" src="https://cdn-images-1.medium.com/max/1024/1*qJr7mG0hu9BeS19h-EEpUQ.png" /></figure><p>8/ <strong>We discuss techniques</strong> that we found by ourselves or we found somewhere else.</p><p>That’s just a few from dozens of topics that we discussed.</p><h3>Actions</h3><p>Some discussions require actions so we add Technical Tasks to our sprints as a result of the meeting. Thanks to having<strong> the first day of a sprint dedicated to technical debt or so-called “maintenance”</strong> we are confident to hit the goal of actually working on stuff that will let our product to be healthy (we will talk about it in a different post).</p><p>When something is in progress then it lands in the proper column. <strong>Some tasks may take a while</strong>, like the one where we removed 153 colors (sic!) from our product and replaced it with our own palette:</p><figure><img alt="Part of our Styleguide defining colors" src="https://cdn-images-1.medium.com/max/1024/1*0t20wz8R4RG8sa2B8OKU4w.png" /><figcaption>One of the results of our Alignment meetings — a simple palette of colors instead of 153 colors defined in our CSS files</figcaption></figure><p>That was a real quest! ⚔️</p><h3>Benefits</h3><p>The obvious benefit of these meetings is spreading knowledge among the team. It also <strong>increases the quality of the product itself</strong>. I believe that great developers lead by example so <strong>when you see that others care, you care as well.</strong></p><p>Just talking with folks that are interested in the same stuff as you can give you a lot of energy. That might sound weird that we are excited to see that someone went for an extra mile and made modals dismissible by hitting ESC key… but details count… and front-end developers love these tiny details.</p><p>At this meeting, your efforts will be very appreciated by your team-mates.</p><h3>Takeaway</h3><p>Make your team of front-end developers happy and <strong>organize an alignment meeting</strong> for them. Let them discuss “front-end stuff”. Keep it organized (see agenda). <strong>They will love it! 😍</strong></p><p>PS. Give them time to actually work on stuff they’ve discussed.<br>PS2. Our backend developers started their own <em>alignment meeting</em> and they love it too.</p><p><a href="https://twitter.com/tomekdev_"><em>Tomek Nieżurawski</em></a><em> writes also on his own blog — </em><a href="https://tomekdev.com/"><em>tomekdev.com</em></a><em>.</em></p><p><em>We are always looking to speak to amazing engineers about joining the Phorest team. You can check out open roles </em><a href="https://www.phorest.com/about/careers/"><em>here</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=acce06fefb62" width="1" height="1" alt=""><hr><p><a href="https://nothingventured.rocks/alignment-meetings-acce06fefb62">Alignment meetings</a> was originally published in <a href="https://nothingventured.rocks/">Nothing Ventured</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Highlight matching text in JavaScript]]></title>
            <link>https://tomekdev.medium.com/highlight-matching-text-in-javascript-ff803c9af7b0?source=rss-ad47e06ba29e------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff803c9af7b0</guid>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[Tomek Niezurawski]]></dc:creator>
            <pubDate>Mon, 11 Jan 2021 07:15:09 GMT</pubDate>
            <atom:updated>2021-01-11T07:15:09.656Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Highlight text in JavaScript" src="https://cdn-images-1.medium.com/max/1024/1*Af9Bi4UlnO0r489F91e6lQ.png" /></figure><p><em>This post was originally published on </em><a href="https://tomekdev.com/posts/highlight-text-in-javascript">https://tomekdev.com/posts/highlight-text-in-javascript</a><em>. What you see as GIF here is interactive there.</em>✌️</p><p>In the previous post about <a href="https://tomekdev.com/posts/search-with-typo-tolerance">search with typo tolerance</a>, I added a few interactive elements to demonstrate the idea of how we can improve search functionality on the page by being more tolerant to typos. You might be curious how I made highlighting of matching text within results. So here it is.</p><p>It’s not super complicated but I’ll give you a very nice hint you might not know :) <strong>Here is the demo</strong>. Look at the GIF below (or visit my website to play with that) and observe how words are highlighted:</p><figure><img alt="Highlighting text in JS" src="https://cdn-images-1.medium.com/max/918/1*VMFxc_V0Jd5uSizI9t3pUA.gif" /></figure><p>The trick is to replace all occurrences of searched text with the same text but wrapped with &lt;mark&gt; this time. We will also add a highlight CSS class to that &lt;mark&gt; so we will be able to style it accordingly. <strong>You don&#39;t need any JS library for that.</strong> Here is the code that does the job:</p><pre>const $box = document.getElementById(&#39;box&#39;);<br>const $search = document.getElementById(&#39;search&#39;);<br><br>$search.addEventListener(&#39;input&#39;, (event) =&gt; {<br>  const searchText = event.target.value;<br>  const regex = new RegExp(searchText, &#39;gi&#39;);<br><br>  let text = $box.innerHTML;<br>  text = text.replace(/(&lt;mark class=&quot;highlight&quot;&gt;|&lt;\/mark&gt;)/gim, &#39;&#39;);<br><br>  const newText = text.replace(regex, &#39;&lt;mark class=&quot;highlight&quot;&gt;$&amp;&lt;/mark&gt;&#39;);<br>  $box.innerHTML = newText;<br>});</pre><p>Let’s assume the $box is the element that contains text (it could be a whole page) and the $search is the input. In line 8 we get the current HTML in the$box and remove all current highlights in the following line. We do that to clean-up after ourselves. We don&#39;t want to keep old searches (or partial searches) on the screen. You can <a href="https://codepen.io/tniezurawski/pen/wvzyVEE">play with that on codepen</a> so you&#39;ll see the HTML structure and CSS styles (where only the .highlight is important).</p><p>The hint I’ve mentioned before you could potentially miss is $&amp; in the second argument of the replace method. This is <em>a special replacement pattern</em> that tells the replacer method to <em>insert the matched substring</em> there.</p><p>Why we won’t simply use something like this? So inserting the searched text?</p><pre>// ...<br>const searchText = event.target.value;<br>// ...<br>const newText = text.replace(<br>  regex,<br>  `&lt;mark class=&quot;highlight&quot;&gt;${searchText}&lt;/mark&gt;`<br>);</pre><p>By doing that <strong>we will get into trouble with the case of the letters</strong>. Most search/find functionality is case insensitive so we don’t want to mess with that. Consider the example below, where I simply wrap the searched text with a&lt;mark&gt; with that text inside:</p><figure><img alt="Bad highlighting at work" src="https://cdn-images-1.medium.com/max/918/1*lKzL89HJddCne_cNraVC5Q.gif" /></figure><p>It’s strange, isn’t it? <strong>Fortunately, we don’t have to be super clever</strong> to keep the case of the matched text. We just need to use$&amp; with the replace method.</p><h3>React implementation</h3><p>React seems to be the most popular library that people use these days. But no matter what front-end framework you use, you’ll probably pass text as an argument to a component with search-and-highlight functionality. It could be also a label of searchable items on a list.</p><p>That simplifies things a bit because we don’t have to get a raw text from DOM elements. And we don’t have to clean up after ourselves. We can focus on the wrapping part and leave the rendering to the rendering engine:</p><pre>import React, { Component } from &#39;react&#39;;<br><br>export default class HighlightText extends Component {<br>  constructor(props) {<br>    super(props);<br>    this.state = { searchText: &#39;&#39; };<br>    this.search = this.search.bind(this);<br>  }<br><br>  search(event) {<br>    this.setState({ searchText: event.target.value });<br>  }<br><br>  _getText(text, searchText) {<br>    return searchText ? this._getTextWithHighlights(text, searchText) : text;<br>  }<br><br>  _getTextWithHighlights(text, searchText) {<br>    const regex = new RegExp(searchText, &#39;gi&#39;);<br>    const newText = text.replace(regex, `&lt;mark class=&quot;highlight&quot;&gt;$&amp;&lt;/mark&gt;`);<br>    return &lt;span dangerouslySetInnerHTML={{ __html: newText }} /&gt;;<br>  }<br><br>  render() {<br>    const { cite, text } = this.props;<br>    const { searchText } = this.state;<br>    const textToShow = this._getText(text, searchText);<br><br>    return (<br>      &lt;div className=&quot;container&quot;&gt;<br>        &lt;div className=&quot;search-container&quot;&gt;<br>          &lt;label htmlFor=&quot;search&quot;&gt;Search within quoted text&lt;/label&gt;<br>          &lt;input<br>            id=&quot;search&quot;<br>            placeholder=&quot;Type `web` for example&quot;<br>            type=&quot;search&quot;<br>            autoComplete=&quot;off&quot;<br>            onChange={this.search}<br>            value={searchText}<br>          /&gt;<br>        &lt;/div&gt;<br>        &lt;blockquote cite={cite}&gt;{textToShow}&lt;/blockquote&gt;<br>      &lt;/div&gt;<br>    );<br>  }<br>}</pre><p>(<a href="https://codesandbox.io/s/zealous-blackburn-54310?file">link to sandbox</a> if you’d like to play with that)</p><p>The most important lines in this implementation are lines 20 and 21. The first one is the heart of highlighting implementation and the second makes sure to set <em>dangerous HTML</em> content within an element.</p><h3>What’s so dangerous about the wrapped searched text?</h3><p><strong>Every framework has to sanitize raw HTML</strong> if you plan to display it on the screen. Here we are sure that the content is ok. It’s provided by the user but not displayed anywhere else than their computer so it’s safe by definition.</p><p>Search for “html safe <em>+ framework name</em>” to find a way to force the rendering engine to display a wrapped element.</p><p>Good luck!</p><p><em>For more posts like this with interactive elements instead of GIFs, please visit tomekdev.com</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff803c9af7b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Search with typo tolerance]]></title>
            <link>https://uxdesign.cc/search-with-typo-tolerance-2c78abbb96a6?source=rss-ad47e06ba29e------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c78abbb96a6</guid>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[search]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[user-experience]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Tomek Niezurawski]]></dc:creator>
            <pubDate>Sun, 03 Jan 2021 11:56:32 GMT</pubDate>
            <atom:updated>2021-01-03T11:56:32.825Z</atom:updated>
            <content:encoded><![CDATA[<h4>Surprise your users with a typo-tolerant search. Let them know that you care about them and you’ll try to do your best to show some results.</h4><figure><img alt="Hero image with “thypo torelance” as a misspelled form of “typo tolerance”" src="https://cdn-images-1.medium.com/max/1024/1*T9GFzRpxYsphychilTCZrA.png" /></figure><p>Everyone makes mistakes. That’s why undo/redo is a must-have for interfaces where you work on something. That’s why we add extra padding around clickable elements for touch screens so it’s easier to catch touches. That’s why Google tries to show some results even if what you typed is far from perfect.</p><p>Users absolutely love that and they can’t imagine software without ctrl+z and looking at a &quot;No results&quot; page when they mistyped something. It seems that the bar is high... but still, a <strong>lot of software does only what is convenient for developers</strong> when it comes to searching and showing results.</p><h3>Examining the problem</h3><p>Below we have a simple search that’s going to work like filtering on the list. The list is short so it’s going to be easy to understand what’s happening. In other words, we already have all elements on the screen but searching is going to help us in finding <em>that thing</em>.</p><p>Please look at the list and watch as I am typing something there, misspelling something, or typing something completely different. <a href="https://tomekdev.com/posts/search-with-typo-tolerance">You can play with it on my page</a>.</p><figure><img alt="Searching with %LIKE% queries" src="https://cdn-images-1.medium.com/max/540/1*3wWNtTy2AXg0jVSHJ2loMg.gif" /></figure><p>What we’ve just used here is a simple “contain” query. Or if you are familiar with SQL — we perform %LIKE% here. Is it bad? Well, it&#39;s okay. Better than strict comparison for sure. But it&#39;s not super friendly <strong>because you have to be right</strong>.</p><p>The hearth of this method is highlighted in the code below. We filter the list by checking if any fruit name contains the searched text. There is <strong>a bit of user-friendliness</strong> here — the search is case insensitive which is the desired behavior in most text searches done by users:</p><pre>const FRUITS = [‘Apple’, ‘Banana’, ‘Blueberry’, ‘Cherries’ /* etc… */];</pre><pre>function searchHandler(event) {<br>  const searchText = event.target.value.toLowerCase();</pre><pre>  const filteredFruits = FRUITS.filter((fruit) =&gt; {<br>    return fruit.toLowerCase().includes(searchText); // HERE<br>  });</pre><pre>  // render the list of `filteredFruits`<br>}</pre><h3>Introducing a tolerance</h3><p>What about tolerating small mistakes aka typos? Let’s try again. Search for fruits on the list but misspell them this time. Maybe aple instead of apple?</p><figure><img alt="Searching with typo tolerance" src="https://cdn-images-1.medium.com/max/540/1*78GnKwF0bugwcGEakO0fdA.gif" /></figure><p>Aple, I mean Apple is still on the list, right? Same with bananna, blubery, cheries, peer, and so on. I must admit, the algorithm is not auto-search friendly. The experience is much better with the [Search] button because you won&#39;t see false friends here while typing. But it&#39;s so much better for understanding how it works...</p><p>Let’s try pee 🤭 for example. You should see Apple and Pear on the list. Both are pretty close matches according to the algorithm we are using:</p><figure><img alt="Searching for “pee”. Apple and Pear are on the list" src="https://cdn-images-1.medium.com/max/1024/1*48ogHwTcbmfr5PFueoirnw.png" /></figure><h3>The algorithm</h3><p>The algorithm used here is called <em>Levenshtein distance</em>. I’m going to quote Wikipedia on this:</p><blockquote><em>[…] the Levenshtein distance between two words is the minimum number of single-character edits (insertions, deletions or substitutions) required to change one word into the other.</em></blockquote><p>That’s both a huge advantage and a problem sometimes. The shorter the names of searchable items are the worse for the algorithm. Very short words like Pear, are favored when typing because the number of edits needed to “having a match” will be relatively short comparing to a very long word that needs a lot of insertions.</p><p>As stated in the definition, in the very heart of this algorithm <strong>we calculate the distance</strong>. Then we decide if the distance is something we accept — <strong>so what’s the minimum of edits that we accept?</strong> Let’s visualize that and see how far words are from your searched text:</p><figure><img alt="Apple and Pear are quite close to “pee”" src="https://cdn-images-1.medium.com/max/1024/1*TMMwvOp7cz8_k2Y1bf01xQ.png" /></figure><p>Let’s go back to our embarrassing pee example 🤭. What you should see on the screen is Apple (3) and Pear (2). How the distance is measured? Please look below:</p><figure><img alt="Illustration on how the distance is measured" src="https://cdn-images-1.medium.com/max/700/1*eW53oDnk2Sfl5xfOpEYvtg.png" /></figure><p>In the case of Apple we need to perform 3 operations to get there from “pee”: add A and p and change the first e into l. When it comes to Pear, there are only 2 operations that have to be taken: change the second e into a and add r at the end. As you see it&#39;s easier to get Pear from the given input.</p><p>So far we were just keeping the order of items as it was (alphabetical here). But in fact, Pear is closer to what we need than Apple and that option should land as first on the list.</p><p>Fear not, we are just going to sort it! Take a look:</p><figure><img alt="Search results ordered by distance" src="https://cdn-images-1.medium.com/max/540/1*TI4xhFeVpBmIAHT26nYfSA.gif" /></figure><h3>Implementation</h3><p>So how it works? In a nutshell, we’ve just changed the searching/filtering algorithm (see highlighted lines).</p><pre>const FRUITS = [&#39;Apple&#39;, &#39;Banana&#39;, &#39;Blueberry&#39;, &#39;Cherries&#39; /* etc... */];<br>const MIN_DISTANCE = 3;</pre><pre>function searchHandler(event) {<br>  const searchText = event.target.value.toLowerCase();</pre><pre>  const filteredFruits = FRUITS.filter((fruit) =&gt; {<br>    // HIGHLIGHT STARTS<br>    const distance = levenshtein(fruit.toLowerCase(), searchText);<br>    return distance &lt;= MIN_DISTANCE;<br>    // HIGHLIGHT ENDS<br>  });</pre><pre>  // render the list of `filteredFruits`<br>}</pre><pre>function levenshtein(a, b) {<br>  // The Levenshtein&#39;s algorithm calculating the distance<br>}</pre><p>We compare distance by using Mr. Levenshtein’s method and if the distance is higher than the minimal distance we accept we decide to filter these entries out.</p><p>When it comes to the algorithm itself, you may want to implement it on your own based on the definition on Wikipedia. But if there is anything I know about computing, is that there are methods way faster than what comes to your mind first, when you look at the mathematical equation.</p><h3>Perfect tolerance (distance)</h3><p>I couldn’t find any equation for that but my best guess is that <strong>the minimum tolerance (distance)</strong> that you should accept should be <strong>a bit smaller than the shortest word</strong> in your dataset. Otherwise, there is a possibility that this word will appear too often.</p><h3>Hybrid approach</h3><p>If you haven’t noticed yet, I use a combination of %LIKE% match and Levenshtein&#39;s method. So we fall back to the latter method only if we don&#39;t have typical matches. That&#39;s handy because the &quot;exact&quot; match is probably what users want. They probably don&#39;t care about other variants of a searched text that could be considered as a &quot;fixed&quot; typo if they have exactly what they were looking for.</p><h3>Is that a perfect method?</h3><p>Well, it’s not. Like most solutions, <strong>it doesn’t have to be perfect</strong>. If it adds more value than can bring confusion (because of false friends in results sometimes) then it’s useful.</p><p>Levenshtein’s method is one of many for a given subject. If you’d like to see more experiments like that, let me know.</p><h3>Bonus: Does Google do the same?</h3><p>Nope. Their <em>“Did you mean?”</em> functionality in search is very different from this. As far as I know, they based it on us (the users) who correct queries when we can’t find anything useful because of typos. This way, with the unbelievable amount of data they possess, they can teach the algorithm what’s the best guess for given “typos”. It’s far more sophisticated but it can be super-efficient for long queries.</p><p>Anyway, for our <strong>front-end needs</strong> and as a first attempt at helping users with typos in search I think we are <strong>good enough</strong> with the Levenshtein method. <strong>What do you think?</strong></p><p><em>This post was originally published on </em><a href="https://tomekdev.com/posts/search-with-typo-tolerance"><em>https://tomekdev.com/posts/search-with-typo-tolerance</em></a><em>. What you see as GIF here is interactive there.</em>✌️</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/94/0*iwMoDMe0ehNeYIS3" /><figcaption>The UX Collective donates US$1 for each article published on our platform. This story contributed to <a href="https://www.bayareablackdesigners.com/">Bay Area Black Designers</a>: a professional development community for Black people who are digital designers and researchers in the San Francisco Bay Area. By joining together in community, members share inspiration, connection, peer mentorship, professional development, resources, feedback, support, and resilience. Silence against systemic racism is not an option. Build the design community you believe in.</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c78abbb96a6" width="1" height="1" alt=""><hr><p><a href="https://uxdesign.cc/search-with-typo-tolerance-2c78abbb96a6">Search with typo tolerance</a> was originally published in <a href="https://uxdesign.cc/">UX Collective</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[We chose Ember in 2015 and it is still a good decision in 2020]]></title>
            <link>https://nothingventured.rocks/we-chose-ember-in-2015-and-it-is-still-a-good-decision-in-2020-c2eb1502a20a?source=rss-ad47e06ba29e------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2eb1502a20a</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ember]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[emberjs]]></category>
            <dc:creator><![CDATA[Tomek Niezurawski]]></dc:creator>
            <pubDate>Tue, 17 Nov 2020 12:07:21 GMT</pubDate>
            <atom:updated>2020-11-17T18:55:23.036Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Ember &amp; Phorest logos connected with a plus symbol" src="https://cdn-images-1.medium.com/max/1024/1*AEb6ccul0Agc8ZapF1j3qw.png" /></figure><p>… and will be in 2021 in my opinion. Here is why, but first:</p><h3>A bit of background</h3><p>Phorest is a company with a product that has evolved a lot in the last decade. Its main application is a desktop app that talks to a database in the Cloud (AWS). Being in the process of moving that desktop app to web, <strong>we had to choose (and bet on) a front-end framework</strong> that will help us accomplish our goals quickly and with high quality. Ember was that choice.</p><p>Here are the main characteristics that we hoped for and that have proven to be true.</p><h3>Conventions</h3><p><strong>It can seem counter-intuitive but</strong>,<strong> </strong>some “limitations” and so-called conventions can save you a lot of time in the long run and ensure the high quality of the product. It’s not a new concept and the most prominent example is probably Ruby on Rails. It’s not really about not being able to do something but doing it in a certain way. In other words, having a solution for how to do common things.</p><p>We all depend on other humans’ work and we don’t have to reinvent the wheel on every project we start. Knowing that a lot of people around the world have tested strategies that you are going to use can calm your soul. You can focus on business value. <strong>Users really don’t care how you manage the state in your app.</strong> It just has to work.</p><p>With that said, Ember offers much more than React or other frameworks. There is a whole philosophy on how you should do things. Of course, the learning curve is steep because of that but on the other hand, if you’ve just started with a framework you don’t experience <a href="https://en.wikipedia.org/wiki/Analysis_paralysis"><em>decision paralysis</em></a><em>,</em> thinking:</p><ul><li>how to manage your state (what library we should use?),</li><li>what’s the best router library?</li><li>how to “reuse” the data you’ve already fetched?</li><li>how to work with different sources of data?</li><li>how to organize your application structure?</li><li>what testing library is going to be cool in 2021?</li><li>how to deploy my app?</li></ul><p>Ember has you covered and that will boost your productivity and building speed. There is no reason to pretend that we don’t live in the business world. Being fast and producing high-quality software is important for every software company. No matter if you are like Phorest — 17 years into building software or you are a startup that has to get the job done quickly.</p><h3>We don’t have to reinvent the wheel</h3><p>I’d like to stress out this part. After all, every ready to use solution you see in Ember is <em>just a code</em>. <strong>You could write it on your own.</strong> But it will take time and the chances that you will miss something are higher.</p><p>Let’s take adapters and serializers for example. At Phorest we have different sources of data, with different standards used. It’s maybe not ideal, but this is how it is if the company you work for has more than one API. With the right architecture, you don’t have to think about how one of your servers likes the data to be served. You just have to configure that once, and chances are very high that there is already an addon that will handle the communication for you.</p><p>Later on, in your code, you’ll not be able to differentiate that data comes from servers that speak very different standards.</p><h3>Stability</h3><p>The last thing you want is to take BIG steps when upgrading your framework of choice. <strong>Software evolves. It has to.</strong> Only small Linux terminal tools can be considered as finished. But web frameworks will change.</p><p>Ember follows 6-week cycles when releasing a new version of the framework. That’s very predictable. If they decide to remove something from the API you should not be surprised. A lot of new functionality is <a href="https://github.com/emberjs/rfcs">first discussed in RFCs</a>. And the best part… <strong>it is often introduced as an addon (plugin) to the framework</strong>. This way, the maintainers can gather early feedback without introducing something to the main code.</p><p>Another thing worth mentioning is <a href="https://github.com/ember-codemods">codemods</a>. Changes in syntax are often accepted only if there is an automated script (codemod) converting old code into new. I’m not sure which framework first started using that approach but it’s in Ember’s philosophy for a long time.</p><p>Ember used to advertise itself with “<em>stability without stagnation</em>” and that’s true. Recently, the motto had to be changed into something more catchy but that rule is kept in my opinion.</p><h3>Ecosystem</h3><p>Ember is rather known for a good ecosystem of libraries and plugins. <a href="https://www.emberobserver.com/">Ember Observer project</a> should help you in understanding how well maintained libraries are. Some of the popular addons where authors were no longer able to continue their work on it were adopted by the Ember community. That tells a lot about the maturity of the ecosystem.</p><p>So again, something important for us, we see that people take it seriously and we are not that worried if some dependency will be abandoned.</p><p>When possible we try to add value to the ecosystem and collaborate on <a href="https://github.com/ember-cli-deploy">addons</a> <a href="https://github.com/yapplabs/ember-buffered-proxy">and</a> <a href="https://github.com/vastec/ember-unused-components">tools</a>.</p><h3>Community</h3><p><a href="https://emberjs.com/community">Ember’s community</a> <strong>was always described as friendly</strong> and <strong>we can confirm that</strong> in our journey. Unfortunately, it’s not that big as for other frameworks but so far we have not stuck on any problem and you should be able to find useful information just by googling the problem.</p><p>That’s important because every developer searches for solutions in their everyday job. Picking a trendy but buggy framework with a still relatively small community can turn your work into a nightmare. To be honest, Ember was in that band a few years ago. It wasn’t easy to find a good solution and the SEO of official guides and API reference wasn’t great. That often led to outdated information. But those days are gone.</p><h3>Future</h3><p>Ember is evolving to use native ES6 features and the newest techniques in the front-end world. That’s not easy for a framework that is around for a few years. Actually, something that people don’t like Ember about — `Ember.Object` — paved the way for modern implementations. But that legacy is problematic now. The Ember Octane project is the answer to a lot of pain points and killing the so-called “Ember Way” (<a href="https://ember-learn.github.io/ember-octane-vs-classic-cheat-sheet/">click here to see a cheat sheet with a comparison on what changed</a>).</p><p>We see the future of the framework’s evolution as bright.</p><h3>It’s not all rainbows and unicorns</h3><p>Of course, we have to be fair. I don’t want to justify our decision for all cost just to say “it’s great” with tears in my eyes. No. I just want to say that <strong>for us using Ember was a very good choice</strong>.</p><p>With all bets like this, you pick a tool for a job and you’ll see what happens.</p><p>So let’s see what the downsides of using Ember (for us) have been:</p><ul><li>it has a reputation of hard to learn with a high learning curve and,</li><li>it doesn’t have a sponsor with huge marketing budgets (like Angular and Google, React and Facebook) — <strong>so it will stay niche</strong>,</li><li>its building process, once the best in class (or even a pioneer), is now obsolete and has to be replaced with something modern <strong>and popular</strong>.</li></ul><p>A common belief that we found not entirely true when talking about downsides, is that Ember <em>has a relatively small community so it’s not easy to find someone for a job. </em>While we get fewer applications, the people that claim to know Ember seem to know it better than people claiming to know React actually know it.</p><h3>Summary</h3><p>We are all in. It worked for us and saved a lot of time during our journey. The worst that can happen to us is a collapse of the community but we don’t see it happening in the foreseeable future.</p><p>Happy coding with Ember 🙌</p><p><a href="https://twitter.com/tomekdev_"><em>Tomek Nieżurawski</em></a><em> writes also on his own blog — </em><a href="https://tomekdev.com/"><em>tomekdev.com</em></a><em>.<br>Special thanks to </em><a href="https://twitter.com/grandazz"><em>Aaron Chambers</em></a><em> and </em><a href="https://twitter.com/jonny_fj"><em>Jonny Green</em></a><em> for their feedback.</em></p><p><em>We are always looking to speak to amazing engineers about joining the Phorest team. You can check out open roles </em><a href="https://www.phorest.com/about/careers/"><em>here</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2eb1502a20a" width="1" height="1" alt=""><hr><p><a href="https://nothingventured.rocks/we-chose-ember-in-2015-and-it-is-still-a-good-decision-in-2020-c2eb1502a20a">We chose Ember in 2015 and it is still a good decision in 2020</a> was originally published in <a href="https://nothingventured.rocks/">Nothing Ventured</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Useful setup that I always use when starting a new project]]></title>
            <link>https://tomekdev.medium.com/useful-setup-that-i-always-use-when-starting-a-new-project-d6fe196966e5?source=rss-ad47e06ba29e------2</link>
            <guid isPermaLink="false">https://medium.com/p/d6fe196966e5</guid>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[tools]]></category>
            <dc:creator><![CDATA[Tomek Niezurawski]]></dc:creator>
            <pubDate>Mon, 16 Nov 2020 09:39:51 GMT</pubDate>
            <atom:updated>2020-11-16T09:39:51.138Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="People just before a start" src="https://cdn-images-1.medium.com/max/1024/1*3cYltBzoBXs903UzMIKvaQ.png" /></figure><p><em>This post was originally published on </em><a href="https://tomekdev.com/posts/powerful-start"><em>https://tomekdev.com/posts/powerful-start</em></a><em>. Go there for slightly nicer code snippets.</em> ✌️</p><p>I’m not a huge fan of “the art of the start” articles because, after all, <strong>starting in a non-optimal way is worth more than not starting at all</strong> with a head full of knowledge that wasn’t applied.</p><p>With that said, I still have a list of useful stuff that was proven to be working extremely well. The setup is meant to remove some worries from your head and focus on the product/project.</p><h4>1. Use version control — git</h4><p>We start with an obvious one. Even if you don’t work on software, use version control, and commit regularly. It will pay off when you make mistakes (everyone does them). When it comes to my projects, I always have to add .idea to .gitignore because I&#39;m using WebStorm 🙄</p><h4>2. Use .editorconfig</h4><p>Tabs vs spaces? Inconsistent indent between different files or between team members? There is a <a href="https://editorconfig.org/">well-established solution</a> for that. Even if you are the only person working on the project, do yourself a favor and share.editorconfig between your projects. Most IDEs will read that file and keep the format of files the way you want.</p><p>My personal preference is to apply a consistent style to ALL types of files by setting a small indent, trimming whitespaces, and inserting a new line at the end of the file:</p><pre>root = true</pre><pre>[*]<br>end_of_line = lf<br>charset = utf-8<br>trim_trailing_whitespace = true<br>insert_final_newline = true<br>indent_size = 2</pre><h4>3. Add linters</h4><p>Linters everywhere! Really.</p><p>Linter is a tool (script) that checks if you keep a certain “style” in your files. That is enforced by following the rules. Some rules will try to keep you out of trouble, where the community knows that certain construction can harm you. And some others will enforce visual style. That’s good as well because it ends useless discussions about the style of code, removes inconsistency and frustration within the team.</p><p>A lot of rules comes with autofixable feature that can modify the code for you. Not only pointing what’s wrong.</p><p>Remember to update your linter dependencies regularly and check their release notes for new rules!</p><p>Note: <a href="https://palantir.github.io/tslint/">TSLint</a> would be something worth mentioning as well (to analyze TypeScript syntax) but it was deprecated in 2019 if someone didn’t notice. The proper way of using it now is <a href="https://github.com/typescript-eslint/typescript-eslint">typescript-eslint</a>.</p><h4>4. Add Prettier</h4><p><a href="https://prettier.io/">Prettier</a> is an opinionated code formatter. Linters do affect the way your code looks but prettier is much more in terms of styling the code. It offers support for multiple languages. The reason to use it is similar to linters — <strong>the code should look like written by a single person</strong>. Consistency is worth aiming for because it makes it easier to read the files.</p><p>Believe or not but developers read and think about code more than they actually write.</p><h4>5. Automate it!</h4><p>Having linters and prettier running in Continues Integration is a must. If the rules are violated then the build should fail. The bigger the project is the longer it takes to analyze the whole codebase. <strong>I am a big fan of linting only the files that were changed</strong>. So I am using:</p><ul><li><a href="https://github.com/typicode/husky">Husky</a> — to manage git hooks,</li><li><a href="https://github.com/okonet/lint-staged">Lint staged</a> — to run linters only against files that were changed.</li></ul><p>How does it work? Husky reacts on git hook before committing files. Lint staged runs linters. Here is an example from package.json of one of my projects:</p><pre>&quot;husky&quot;: {<br>  &quot;hooks&quot;: {<br>    &quot;pre-commit&quot;: &quot;lint-staged&quot;<br>  }<br>},</pre><pre>&quot;lint-staged&quot;: {<br>  &quot;*.js&quot;: [<br>    &quot;prettier --write&quot;,<br>    &quot;eslint --cache --fix&quot;<br>  ],<br>  &quot;*.css&quot;: &quot;stylelint \&quot;src/**/*.css\&quot; --fix&quot;<br>}</pre><p>In one of the projects I’m working on, linting JS files take <strong>more than 50 seconds</strong> when run against the whole project. Running it only against files that were modified within a commit takes close to nothing. Here is how it looks when I commit something to my blog:</p><figure><img alt="Lint staged at work" src="https://cdn-images-1.medium.com/max/960/0*qYMbEUA9hO2ufhh9.png" /><figcaption><em>Lint staged at work</em></figcaption></figure><p>I understand some people like to experiment and don’t always have clean commits that will pass linting. Fortunately, you can bypass the checks by adding --no-verify argument. So for example:</p><pre>git commit -m &quot;Blog Post 005: Powerful start&quot; --no-verify</pre><h4>6. Setup CI to deploy quickly</h4><p>That’s another thing worth investing time in the beginning. <strong>The easier it is to deploy the better.</strong> Of course, set the pipeline and deploy only when tests are passing and linters are satisfied. I’m not giving any recipe this time because it differs between projects. If you use a service like <a href="https://www.netlify.com/">Netlify</a> then it should be super easy to do it. If you use something else invest the time to set up the process.</p><p>For open-source projects, I use <a href="https://travis-ci.org/">Travis CI</a> and for commercial (indie) projects I use <a href="https://circleci.com/">CircleCI</a>. I think Travis is completely free for opensource and Circle has a quite generous free plan (<a href="https://circleci.com/pricing/">2,500 credits/week</a>) that will be enough for a side-project.</p><p>In some cases, I have used GitHub Actions, like when I had to deploy a single static file to S3.</p><h4>7. Dependabot</h4><p>Updating your dependencies is important because you get security fixes and regular bugs fix. But who has time to remember about it? No-one. So it’s better to automate that process. If you happen to have tests in place with decent coverage then ideally you should be able to just merge Pull Requests created by <a href="https://dependabot.com/">Dependabot</a>.</p><p>The tool was acquired by GitHub in May 2019 and since then it is offered free of charge.</p><h4>Summary</h4><p>That’s it. A few tools, a few configuration files, maybe two services to keep your project great and ready for fast deployment. <strong>I found myself adding these ingredients to every project I work on</strong>: server-side (in nodejs), React, Ember, Angular, standalone library, <a href="https://checknlearn.com/">Chrome extension</a>, React Native application, and so on. As you see, it’s not bounded to any technology so it’s hard to come up with a starter pack.</p><p>You can set the sails now.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d6fe196966e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Writing effective page titles and more]]></title>
            <link>https://uxdesign.cc/effective-titles-and-more-eef39e7f91d3?source=rss-ad47e06ba29e------2</link>
            <guid isPermaLink="false">https://medium.com/p/eef39e7f91d3</guid>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[ux-writing]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[user-experience]]></category>
            <dc:creator><![CDATA[Tomek Niezurawski]]></dc:creator>
            <pubDate>Sun, 08 Nov 2020 14:56:43 GMT</pubDate>
            <atom:updated>2020-11-10T22:12:43.809Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Hero image with two tabs in a browser saying “(1) Titles can do more than you think”" src="https://cdn-images-1.medium.com/max/1000/1*uSy707D2VnW_TRR-1pQD0A.png" /></figure><p><em>This post was originally published on </em><a href="https://tomekdev.com/posts/effective-titles-and-more"><em>https://tomekdev.com/posts/effective-titles-and-more</em></a><em>. What you see as a GIF here is interactive there.✌️</em></p><p>This is not an SEO guide on how to write effective titles or (maybe I should say) how to create clickbait. No. We are going to talk about the technicals. If you want my writing advice on that I’d say a cliché: “title should be short and descriptive”.</p><p>Did mine do a good job? I don’t know, but if you are here reading this, maybe it did.</p><h3>Site name</h3><p>I believe you should put the site name into the page’s title because that’s going to land as a name of a bookmark if someone happens to add your page to bookmarks (do people still do that?):</p><figure><img alt="Edit bookmark popup showing how site name can fit as a part of title" src="https://cdn-images-1.medium.com/max/692/1*Vm4yNGmacr4itBwvwo3JTg.png" /><figcaption><em>Bookmark added with a clear indication of a site</em></figcaption></figure><p>And will help in fast identification. I see that useful also in the History tool of your browser of choice:</p><figure><img alt="Screenshot of browser’s history showing how easy it is to identify a site with a site name" src="https://cdn-images-1.medium.com/max/1024/1*_5OjG408eHfLRMqhprqtew.png" /><figcaption><em>The site name is prominent on a History list</em></figcaption></figure><p>Now, should you put the site name before or after the title for the content of the page?<br>Well, I believe <strong>after</strong> is the way to go. Again, easy identification comes into play. If everything starts with “Tomek Dev” then you have to omit it to understand what’s this page about. Take a look at this:</p><ul><li>Tomek Dev — Effective titles</li><li>Tomek Dev — If there is an input, there should be a form</li><li>Tomek Dev — Content Curation is going to be a job and how Content Marketing killed the web</li><li>Tomek Dev — Dynamic partiallyActive Link in Gatsby</li></ul><p>Doesn’t look that bad when I have it on a list, right? Right. But consider the real estate of a browser’s toolbar:</p><figure><img alt="Screenshot of browser’s tabs that are packed with titles being cut" src="https://cdn-images-1.medium.com/max/1024/1*6jLz4Yd3mVq-2DEOn-gRaQ.png" /><figcaption>Tabs are packed. Redundant information doesn’t help here</figcaption></figure><p>There is no lot of place but it can be even less if you use a lot of tabs. Having a title of your content first and the site name second will help in identification. The content title is more important for a user:</p><figure><img alt="Screenshot of browsers tab that are packed but still easy to identify because of right order of title elements" src="https://cdn-images-1.medium.com/max/1024/1*Ayuk0gZhuEmYIkEO4uO15A.png" /><figcaption><em>Tabs are still packed but more valuable information gets first</em></figcaption></figure><h3>What separator to use</h3><p>I’m using a pipe — | because my dad is a plumber and I spend a lot of my life in the terminal. What else could I use? 😉<br>Jokes aside, that could be a branding thing. Go crazy if that&#39;s your thing:</p><figure><img alt="Browser tab with a title parts separated by a sign connected to Poker" src="https://cdn-images-1.medium.com/max/1024/1*2Rwk1VvTSofoBnBGCnCq-g.png" /><figcaption><em>Here ♣ separates content title and the site name</em></figcaption></figure><figure><img alt="Browser tab with a title parts separated by a sign connected to Law" src="https://cdn-images-1.medium.com/max/1024/1*aj40ISUu0FwnHLGfKj5aaQ.png" /><figcaption><em>Legal advice page with § as a separator? Why not</em></figcaption></figure><p>After all, the worst you can do is to have a single title for your entire application. <strong>Don’t do that</strong>.<br>Even if your app is just a tool, think for a while if you don’t have some logical modules there. Because know what? 👇</p><h3>Title can be changed dynamically</h3><p>That’s good news (not only) for Single Page Applications. Use it to <strong>bring users’ attention</strong> to something. Consider Facebook for example:</p><figure><img alt="Browser tab with Facebook that intrigue users to click on it because of having “(1)” in it" src="https://cdn-images-1.medium.com/max/1024/1*ggwV9f10XMIYW1WNnomoeA.png" /><figcaption><em>🤔 Something happened, right?</em></figcaption></figure><p>They encourage you to read the message you’ve just received. All you have to do to change the title of a page is setting it this way:</p><pre>document.title = &#39;A new title! | Tomek Dev&#39;;</pre><figure><img alt="Animation showing how title can be changed dynamically through JavaScript" src="https://cdn-images-1.medium.com/max/1024/1*aqPwhgLknPb1TJSw71RMjQ.gif" /></figure><p>Of course, if a user is already on our page we should not distract them with a flashing title. Maybe change it only if the tab is not active?</p><p>Consider this example, you work on a Video Editing application and people export their movie. The file has to be prepared and it takes time. You can show the progress on the title if they go to a different tab and announce a success. It could look like this:</p><figure><img alt="Animation showing how title can visualise the progress of some action. Here: exporting a video file" src="https://cdn-images-1.medium.com/max/1024/1*dtZvYp5Xesnq1i-0RKOqyg.gif" /></figure><p>First things first. How to detect the change of tab’s visibility? (I’ve just used the right keywords there).</p><pre>document.addEventListener(&#39;visibilitychange&#39;, function () {<br>  console.log(document.hidden);<br>});</pre><p>document.hidden will tell you what&#39;s the status and you can modify the behavior accordingly to your needs. When it comes to the example above it was done this way:</p><pre>const originalTitle = document.title;<br>let isTabHidden = false;<br>let percentage = 0;</pre><pre>function changeTitle(title) {<br>  if (isTabHidden) {<br>    document.title = title;<br>  } else {<br>    document.title = originalTitle;<br>  }<br>}</pre><pre>const interval = setInterval(() =&gt; {<br>  percentage += 1;</pre><pre>  if (percentage &lt; 100) {<br>    changeTitle(`${percentage}% Preparing video | Tomek Dev`);<br>  } else {<br>    changeTitle(&#39;⚬ Your file is ready! | Tomek Dev&#39;);<br>    clearInterval(interval);<br>  }<br>}, 100);</pre><pre>document.addEventListener(&#39;visibilitychange&#39;, function () {<br>  isTabHidden = document.hidden;<br>});</pre><p>It’s obviously a trick to show how it could work. In this place, you’d put your code that updates the percentage value. That can come from a backend endpoint that is preparing the video. No matter if that’s a WebSocket or regular XHR request.</p><p>Note:</p><p>Did you notice how progress slows down when you go to a different tab? It’s because I’m faking the export progress via <em>setInterval</em>. The tab is in the background so Chrome executes the timing function ( <em>setTimeout</em>/ <em>setInterval</em>) once per second at maximum.</p><p>Eagle-eyed folks may notice that visibilitychange listener is not needed in that example. We can use document.hidden directly in our changeTitle function. I added it here only to show that such a listener exists ;) It might be useful in some implementations.</p><p>And do you know who (probably) uses that event? <strong>Github</strong>. Open two tabs, leave an unsaved comment in a PR, and go to another tab. You should see this:</p><figure><img alt="Two browser tabs with Github opened. One of them says (Draft comment) when it loses the focus." src="https://cdn-images-1.medium.com/max/1024/1*oSMUs3XdKDzDTkQ-yjG8Qw.png" /><figcaption>Yeah, I left some work there. Thanks for reminding me!</figcaption></figure><h3>Dynamic === fun</h3><p>Let me give you a few more examples of how you can make your title cool.</p><p>These days, you should see a speaker icon 🔊 if the audio is played in a tab. But it wasn’t always like that. You can animate an audio playing in various ways (click to see in action):</p><ul><li>Let’s show a listener</li></ul><figure><img alt="Animation showing a listener listening to a music in a title of a page" src="https://cdn-images-1.medium.com/max/800/1*MC4-7l_yX4o1H_Ij-zrj-w.gif" /></figure><ul><li>Or a dancer</li></ul><figure><img alt="Animation showing a dancer dancing to a music in a title of a page" src="https://cdn-images-1.medium.com/max/800/1*Ry00lSouCVJ2ESfHVPIs3A.gif" /></figure><ul><li>Equalizer?</li></ul><figure><img alt="Animation showing an equalizer reacting to a music played within a browser card" src="https://cdn-images-1.medium.com/max/800/1*z-JQTKn9jE_R8iOVWarmfg.gif" /></figure><ul><li>Song title floating</li></ul><figure><img alt="Animation showing a floating title of a song played in the browser tab" src="https://cdn-images-1.medium.com/max/800/1*4ob4vOcjWsdqNMD8DgBcQw.gif" /></figure><h3>But be careful</h3><p>Of course, like with every superpower, there is one thing you need to remember. <strong>Don’t overuse it.</strong> Effects like this could be a very nice addition to your page. It can extend the experience and make it better. But it can also be annoying. Like a close button running away from your cursor.</p><h3>Summary</h3><p>Maybe we’ve just scratched the surface of what we can do with &lt;title&gt; but here are some takeaways for you:</p><ul><li>Use a short descriptive title.</li><li>Put your site name after the title describing the page’s content.</li><li>Add a separator between the title’s parts. You can go crazy.</li><li>Use the title’s dynamic nature to extend the user experience.</li><li>Bring users’ attention to a tab if something important happened.</li><li>Don’t overuse dynamic techniques to avoid annoying users.</li></ul><p>The real estate of the browser’s top bar is yours now.</p><p>How to stay in touch? Follow me on Twitter: <a href="https://twitter.com/tomekdev_">tomekdev_</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/94/0*0VEYXJplmD5xHMEF" /><figcaption>The UX Collective donates US$1 for each article published in our platform. This story contributed to <a href="https://www.bayareablackdesigners.com/">Bay Area Black Designers</a>: a professional development community for Black people who are digital designers and researchers in the San Francisco Bay Area. By joining together in community, members share inspiration, connection, peer mentorship, professional development, resources, feedback, support, and resilience. Silence against systemic racism is not an option. Build the design community you believe in.</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eef39e7f91d3" width="1" height="1" alt=""><hr><p><a href="https://uxdesign.cc/effective-titles-and-more-eef39e7f91d3">Writing effective page titles and more</a> was originally published in <a href="https://uxdesign.cc/">UX Collective</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[If there is an input, there should be a form]]></title>
            <link>https://tomekdev.medium.com/if-there-is-an-input-there-should-be-a-form-842120054fb1?source=rss-ad47e06ba29e------2</link>
            <guid isPermaLink="false">https://medium.com/p/842120054fb1</guid>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[accessibility]]></category>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[Tomek Niezurawski]]></dc:creator>
            <pubDate>Mon, 19 Oct 2020 08:24:10 GMT</pubDate>
            <atom:updated>2020-10-19T08:24:10.478Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*7ufBDOuxeZv6RuA822GomQ.png" /></figure><p><em>This post was originally published on </em><a href="https://tomekdev.com/posts/input-and-form"><em>https://tomekdev.com/posts/input-and-form</em></a><em>. Go there to read a bit more interactive and style richer version</em> ✌️</p><p>I often see in Single Page apps a situation where someone uses just an &lt;input&gt; field. Sometimes in the accompaniment of&lt;label&gt; if you happen to work with a pro 🌟. It feels that when we gained control of inputs with two-way binding and we started handling onclick events on buttons with our fancy frameworks, we forgot the old way of doing things.</p><h3>The old way, and the right way</h3><p>The headline of this section may suggest that the old way and the right way are two different things. Where in fact, it’s the opposite. If you come back with your memory before the frameworks (or ajax) era you see that people were using a &lt;form&gt; element when dealing with inputs and buttons.</p><p>In the past we were extensively using &lt;form method=&quot;&quot;&gt; to process the input. <strong>I encourage you to still use a form element</strong>. It comes with benefits.</p><h3>Common mistake</h3><p>I use the keyboard to navigate and interact with pages. That speeds up everything. So for me one of the biggest pitfalls of using &lt;input&gt; without a &lt;form&gt; is that the input is not auto-submittable, so to say.</p><p>When you hit ENTER in the field that is inside the form then the form is submitted. That&#39;s very convenient for solo-input interfaces like a modal below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*bQmbXwsGtYhfAkF0BBeGxg.png" /></figure><p>You don’t have to touch your mouse or touchpad and click Save button 🎉. That would be a waste of time!</p><h3>Solution</h3><p>It’s a common mistake to bind your action to a &lt;button&gt; where in fact all you have to do is wrap your&lt;input&gt; with a &lt;form&gt; and assign submit event to a form:</p><p>HTML file:</p><pre>&lt;form <em>id</em>=&quot;my-form&quot;&gt;<br>  &lt;input <em>name</em>=&quot;example&quot; <em>type</em>=&quot;text&quot; /&gt;<br>  &lt;button <em>type</em>=&quot;submit&quot;&gt;Submit&lt;/button&gt;<br>&lt;/form&gt;</pre><p>Javascript:</p><pre>const form = document.getElementById(&#39;my-form&#39;);</pre><pre>form.addEventListener(&#39;submit&#39;, function handleSubmit(event) {<br>  alert(&#39;Submit clicked&#39;);<br>  event.preventDefault();<br>});</pre><p>Don’t forget to prevent default behavior from firing and run your custom behavior. It could be running validation and actually sending the data.</p><p>One more thing that you should consider is always specifying the button’s type. It’s submit by default in most browsers but Internet Explorer is different in this case and has button as a default type.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=842120054fb1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>