diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js
index 4872200ef15639b1aaf6ee10aa261e8beb81e868..233598c33b1d47444992ffdd6ab1898c67a1e27e 100644
--- a/addons/mail/static/src/js/mail.js
+++ b/addons/mail/static/src/js/mail.js
@@ -1512,7 +1512,7 @@ var ComposeMessageTopButton = Widget.extend({
     on_compose_message: function (ev) {
         ev.preventDefault();
         var ctx = {}
-        if ($('a.oe_compose_post') && $('a.oe_compose_post').is(":visible") == true &&
+        if ($('button.o_timeline_compose_post') && $('button.o_timeline_compose_post').is(":visible") == true &&
              (this.getParent()).getParent().action_manager.inner_widget.active_view.type == 'form'){
             ctx = {
                 'default_res_id': (this.getParent()).getParent().action_manager.inner_widget.active_view.controller.datarecord.id,