Rather than focusing on the button itself, focus on what you want users to do. If you don’t want your users to be able to delete media, and you are also comfortable with them not being able to delete other post types (Posts, Pages, etc.), you can create a custom role for these users.
<?php
// In a plugin, add_role will create an entirely new role to assign to users.
add_role('media_editor', 'Media Editor', array(
// The capabilities below will let these users add, edit, read,
// but not delete any type of content.
'create_posts' => true,
'edit_posts' => true,
'edit_others_posts' => true,
'edit_private_posts' => true,
'edit_published_posts' => true,
'read_private_posts' => true,
'read' => true,
'upload_files' => true
// You may also wish to add capabilities for other post types,
// such as create_pages, edit_pages, or custom capabilities
// for custom post types.
);
?>
Once this code runs, you can then edit each user and change their role to “Media Editor” (or whatever you decide to call it in your code).
By removing the users’ ability to delete any type of posts, they will no longer see the delete button in the media details modal, or any other location. If instead you focus on one button in one modal, you may be leaving other locations – such as the Media Library itself – with buttons they can still use.