diff --git a/app/views/layouts/_flash.html.haml b/app/views/layouts/_flash.html.haml
index 07c271be2f01dd97c91d58d7e769e8bd3241db6a..1424b9a75854643273fd65e904602de8f559f20c 100644
--- a/app/views/layouts/_flash.html.haml
+++ b/app/views/layouts/_flash.html.haml
@@ -8,5 +8,6 @@
       %div{ class: "flash-#{key} mb-2" }
         = sprite_icon(icons[key], size: 16, css_class: 'align-middle mr-1') unless icons[key].nil?
         %span= value
-        %div{ class: "close-icon-wrapper js-close-icon" }
-          = sprite_icon('close', size: 16, css_class: 'close-icon')
+        - if %w(alert notice success).include?(key)
+          %div{ class: "close-icon-wrapper js-close-icon" }
+            = sprite_icon('close', size: 16, css_class: 'close-icon')
diff --git a/changelogs/unreleased/remove-close-button-from-flash-warning.yml b/changelogs/unreleased/remove-close-button-from-flash-warning.yml
new file mode 100644
index 0000000000000000000000000000000000000000..9210d8dc165a86090befbee8f8611870f4155952
--- /dev/null
+++ b/changelogs/unreleased/remove-close-button-from-flash-warning.yml
@@ -0,0 +1,5 @@
+---
+title: Don’t show close icon on flash warning
+merge_request: 36581
+author:
+type: fixed
diff --git a/spec/views/layouts/_flash.html.haml_spec.rb b/spec/views/layouts/_flash.html.haml_spec.rb
new file mode 100644
index 0000000000000000000000000000000000000000..82c06feb4fb579a5806c8beb08d9d1943d55abbd
--- /dev/null
+++ b/spec/views/layouts/_flash.html.haml_spec.rb
@@ -0,0 +1,30 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'layouts/_flash' do
+  before do
+    allow(view).to receive(:flash).and_return(flash)
+    render
+  end
+
+  describe 'closable flash messages' do
+    %w(alert notice success).each do |flash_type|
+      let(:flash) { { flash_type => 'This is a closable flash message' } }
+
+      it 'shows a close button' do
+        expect(rendered).to include('js-close-icon')
+      end
+    end
+  end
+
+  describe 'non closable flash messages' do
+    %w(error message toast warning).each do |flash_type|
+      let(:flash) { { flash_type => 'This is a non closable flash message' } }
+
+      it 'shows a close button' do
+        expect(rendered).not_to include('js-close-icon')
+      end
+    end
+  end
+end